问题
I am programming for an Android application. while clicking a button, it calls a service to display the necessary contents. For calling the service and to parse the XML data present in that service it takes nearly 5 to 10 seconds. In these 5 seconds time period I need to display an activity Indicator with a text stating that "Loading. Please wait...". This part works fine for iPhone. But not in Android.
Any help would be appreciated..
Thanks
回答1:
Check this. Look at "Creating a ProgressDialog" section. Try to parse the XMLs in AsyncTask. When you start the task just show the progress dialog. When the task finishes - hide the progress dialog.
回答2:
if you want to show a message when your service is running you can use Progress Dialog for that.
ProgressDialog dialog = new ProgressDialog(MainActivity.this);
dialog.setMessage("Your message..");
dialog.show();
to dismiss this progress dialog use
dialog.dismiss();
来源:https://stackoverflow.com/questions/6302479/android-activity-indicator