开发者

ProgressBar between to activities in android?

开发者 https://www.devze.com 2022-12-25 18:52 出处:网络
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 prog

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

精彩评论

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