ProgressDialog in Android for new Activity

2019-05-09 09:26发布

问题:

when the user taps a menu item i need to create a new Activity; this activity loads a lot of data then shows a map and takes some seconds to be shown ... How can i use ProgressDialog from an activity to another? I actually cannot see it if i call

ProgressDialog dialog = ProgressDialog.show(this, "", "Loading. Please wait...", true);

Thanks in advance and greetings c.

回答1:

See the answer here

You should use your AsyncTask in onCreate() method of the Activity you start from menu.