0

I want set progress bar until the next activity start.That mean i want to remove black screen while loading next page or activity.How to solve this problem?

yes I'm using button onClick and using listView to move next activity.

1
  • on click of button you are moving to next activity?
    – Sumant
    Jun 4, 2011 at 8:56

3 Answers 3

1
Button b1 = new Button(this);
b1.setOnTouchListener(new OnTouchListener() 
            {
                public boolean onTouch(View v, MotionEvent event) 
                {
                    int action = event.getAction();
                     if(action==0)
                     {
                     }
                     else  if(action == 1)
                     {   
                        final ProgressDialog dialog = ProgressDialog.show(myFirstActivity.this,"Please wait","Loading...",true);
                         new Thread() 
                         {
                               public void run() 
                               {
                                    try 
                                    {
                                        Thread.sleep(2000);
                                    } catch (InterruptedException e) 
                                    {
                                        e.toString();
                                        e.printStackTrace();
                                    }
                                    finally
                                    {
                                        dialog.dismiss();           
                                    }
                               }
                         }.start();
                      } 
                    return false;
                }
            });



     b1.setOnClickListener(new OnClickListener()
                {
                    public void onClick(View v) 
                    {
                             Intent i1 = new Intent(myFirstActiviyt.this,Second.class);
                             startActivity(i1);
                             }
                             });

Try this

3
0

try answer on this link

show progressbar on button click when going from 1 intent to other and data is coming from server

0

here is an example of a progress bar using XML

    <ProgressBar
        android:id="@+id/loading"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="262dp"
        android:layout_height="18dp"
        android:indeterminate="false"
        android:max="100"
        android:progress="55"
        android:progressTint="#02C697"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.