How to show a ProgressDialog while changing from a activity to another activity?

Posted by AndroidUser99 on Stack Overflow See other posts from Stack Overflow or by AndroidUser99
Published on 2011-02-02T18:44:00Z Indexed on 2012/09/12 9:38 UTC
Read the original article Hit count: 245

Filed under:
|

i want to show a PD when my activity A starts another activity B. But in that onclick method, my A activity haves to do some work before start B, and B also haves to do some work because it haves to load a lot of data for the UI.

I need a PD that is viewed by the user in all the process of the loading data of changin from activity A to B.

¿how can do it?

i tryed storing a static ProgressDialog on MyApplication.java, and with these methods:

public static void showProgressDialog(Context c) {
    pd = ProgressDialog.show(c, c.getResources().getString(R.string.app_name), 
        c.getResources().getString(R.string.loading), true, false);    
}
public static void dismissProgressDialog(){
    pd.dismiss();
}

but it doesn't works, it doesn't shows nothing, i dont know why

how to achieve this by a easy way? i know that i can do it with async task, but that is too hard for me, i can't understand the code examples i am finding on this web and google

code examples are welcome

thanks

© Stack Overflow or respective owner

Related posts about android

Related posts about progressdialog