Skip to content Skip to sidebar Skip to footer

Make A Transition Between Activitys

I need to make a transition screen, ou just put a dialog, because the app give a black screen when is creating the database. I have google, and find some solutions for this. One o

Solution 1:

Make use of Asyntask . put your database operation of creating database in asyntask in pre execute start dialog post execute cancel dialog in background perform database operation

http://developer.android.com/reference/android/os/AsyncTask.html

Solution 2:

For that You have to use Async task : 

classDownloadAsyncTaskextendsAsyncTask<String, String, Void>
    {

        ProgressDialog progressDialog;


        @OverrideprotectedvoidonPreExecute() {
            super.onPreExecute();
            progressDialog = ProgressDialog.show(Login.this, "", "Please Wait ...");
        }



        @OverrideprotectedVoiddoInBackground(String... arg0) {

            //Do your Task
        }

        @OverrideprotectedvoidonProgressUpdate(String...values){
            super.onProgressUpdate(values);




        }

        @OverrideprotectedvoidonPostExecute(Void result){
            super.onPostExecute(result);
            progressDialog.dismiss();
        }

    }

//Create the Object

DownloadAsyncTask downloadAsyncTask = new DownloadAsyncTask(); downloadAsyncTask.execute();

now till your work get's completed it shows progress dialog inside the doInbackground write your logic and onPostExecute dismiss the dialog and call Intent of other Activity.

Post a Comment for "Make A Transition Between Activitys"