开发者

ProgressBar between to activities in android?

when click the grid item, i want to show a progressbar between the time of next Activity shown. then the second activity has a custom listview. there also i wa开发者_StackOverflow社区nt to show a progressbar. how to do that?


I'm just learning myself and I haven't had a chance to inspect the source, but I know that the RedditIsFun app (for Reddit, of course) does this in-between loading the next links, and loading comments. Check out the source.


You should try this,

First Create the ProgressDilog in Activity. . .

private ProgressDialog progressDialog;

Now, Set the ProgressDialog in the Any action where u want to Take Some time

progressDialog = ProgressDialog.show(FoodDriveModule.this, "", "Loading...");

Now use Thread to Handle the Progressbar

new Thread() 
   {
    public void run() 
    {
    try
    {
     sleep(1500);
// Now Do some Task whatever u want to do
   } 
   catch(Exception e)
   {
     Log.e("tag",e.getMessage());
   }
}.start();

Thats it. Hope this will help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜