1

I am trying to get simple Progress bar when I clicking on item list that I have while my next activite gets uploading. I looked a lot on the net about this but still cant get the results of what I want. If you can correct my code that it will work correctly. and where I can put this line:

 progDailog = ProgressDialog.show(this,"Process ", "please wait....",true,true);

Here my simple cod:

 lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,
            int position, long id) {

               if (((TextView) view).getText().equals("Zman-New (rus)")){


                   new Thread ( new Runnable()
                     {
                          public void run()
                          {

                            intent = new Intent(rusNewsP.testLoading.this, rusNewsTest.rusNewsActivite.class);
                            intent.putExtra("url","http://www.string.xml");
                           startActivity(intent);
                           finish();
                          }
                     }).start();

                      Handler progressHandler = new Handler() 
                      {

                          public void handleMessage(Message msg1) 
                          {
                              progDailog.dismiss();
                          }
                      };


               }

thanks a lot!

Vitaly Menchikovsky
  • 7,684
  • 17
  • 57
  • 89

1 Answers1

1

Why don't you use Async Task Where you can show progress dialog and in background you can do heavy operations.

Community
  • 1
  • 1
Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243