开发者

show dialog when application/activity startup [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonab开发者_开发知识库ly answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

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


Sure you can show a dialog, look on the answer Displaying alerts in Activity.onCreate(..)


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.


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

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


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);             }
  }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜