Hugh.Wang
Hugh.Wang

Reputation: 17

Android log in and waiting screen

I was developing an app log in page, and was trying to add a waiting page using an activity in dialog style, just like the picture. So, in the logging-in code, I set up a thread for connecting to network and validating the account, also set up a thread for starting the waiting page. But, if it validated successfully, how can the app destroy the waiting page and enter the main function activity? If it failed, how can the app destroy the waiting page and return to the log-in page?

enter image description here

Upvotes: 0

Views: 948

Answers (1)

Ahmed Faraz
Ahmed Faraz

Reputation: 118

You can use a progress dialog for this purpose. If you are using Async Task then declare a dialog as:

ProgressDialog progressDialog;

And display it in "onPreExecute" procedure as:

progressDialog = ProgressDialog.show(Login.this, "Login",
                    "Please wait for a while.", true);

And, in "onPostExecute" procedure close the dialog after loggin in as:

progressDialog.dismiss();

Upvotes: 1

Related Questions