tags:

views:

82

answers:

4

can we show the dialog when our appliaction/activity startup?

A: 

http://www.droidnova.com/how-to-create-a-splash-screen,561.html

There appears to be lost of information on this - just Google it.

Barry
in my application i am doing some database side functionalityi get all data from the xml file that is placed on some server...and store those data on database...after that i am showing the data on screen...Here single activity do all of the work(load data from url,store the data and show the data on screen)...so that activity take sometimes to finish all the process...at that time screen show as blank...i want to show the dialog or progress on that screen...can we do this?
Kandhasamy
A: 

Sure you can show a dialog, look on the answer http://stackoverflow.com/questions/3509391/displaying-alerts-in-activity-oncreate/3509503#3509503

Konstantin Burov
in my application i am doing some database side functionalityi get all data from the xml file that is placed on some server...and store those data on database...after that i am showing the data on screen...Here single activity do all of the work(load data from url,store the data and show the data on screen)...so that activity take sometimes to finish all the process...at that time screen show as blank...i want to show the dialog or progress on that screen...can we do this?
Kandhasamy
You need to implement AsyncTask then http://stackoverflow.com/questions/3490674/observer-pattern-in-android/3490807#3490807 look at the example.
Konstantin Burov
+1  A: 

You can have a look at AsynTask. Amongst others there are three methods which can serve your requirement.

onPreExecute, onPostExetcute and doInBackground;

start the progress dialog in onPreExecute dismiss the progress dialog in onPostExetcute do you connection in doInBackground.

Hope that will serve your purpose.

Umesh
A: 

try this way in post execute display your database from database. and pre execute start dialog and post execute close it. if you want to show horizontal incrementing progress bar then in do in backgrond put that code that i have there.

private class DownloadImageTask extends AsyncTask {

protected Bitmap doInBackground(String... urls) {

          while (myProgress<length){
                 myProgress=myProgress+1;  
                 myProgressBar.setProgress(myProgress);

          }
           return decodeImage(urls[0]);
      }

      protected void onPostExecute(Bitmap result) {
          dialog.dismiss();
          imView.setImageBitmap(result);
      }           protected void onPreExecute() {
  // Things to be done while execution of long running operation is
           in progress. For example updating
             ProgessDialog dialog = ProgressDialog.show(BusinessCardActivity.this,
            "Loading.........", "Wait For Few Second", true);             }
  }
ud_an