如何进度进度条

Sam*_*dar 1 java eclipse android progressdialog

我希望进度条在匹配字符串时增加.就像我点击"是"一样,"是"栏会增加.但由于某种原因,我无法取得进展.

码:

public class result extends VoteActivity{

        private ProgressBar mProgress;
     private int mProgressStatus = 0;

     private Handler mHandler = new Handler();

     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

         setContentView(R.layout.alert);
if(choice=="Yes")
{   
         mProgress = (ProgressBar) findViewById(R.id.p1);

         // Start lengthy operation in a background thread
         new Thread(new Runnable() {
             public void run() {

                     ++mProgressStatus;


                     // Update the progress bar
                     mHandler.post(new Runnable() {
                         public void run() {
                             mProgress.setProgress(mProgressStatus);
                         }
                     });

             }
         }).start();
}
Run Code Online (Sandbox Code Playgroud)

我在这做错了什么?

Flo*_*ern 5

你无法比较字符串==.你需要使用equals():

if(choice.equals("Yes"))
Run Code Online (Sandbox Code Playgroud)