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? Commented Jun 4, 2011 at 8:56

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

3 Comments

ah Sumant i need one more help how to use horizontal progress bar instead of this
Hello Sumant i have one problem. In spinner progress dialog that spinner not rotating
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"/>

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.