Skip to content Skip to sidebar Skip to footer

Android- Status Bar Notification With Progress Bar

I currently have a status bar notification that goes off when an mp3 is downloaded from a url. It launches fine (and the file does download fine), however, the progress bar doesn't

Solution 1:

http://developer.android.com/training/notify-user/display-progress.html

This will work for you until the app is running on foreground. If the app stops the progress bar gets stuck. Its better to download using a service

Solution 2:

Try the following -

publicclassDownloadFileextendsAsyncTask<String, Integer, String>{
    ProgressDialog pd;

    publicDownloadFile() {
    super();
    pd = ProgressDialog.show(context, "Loading..", "Doing Stuff", true,false);
    }

    @OverrideprotectedStringdoInBackground(String... url) {
        //stuff
    }


    @Overrideprotectedvoid onPostExecute (Boolean result){

    pd.dismiss();

    }


}

Post a Comment for "Android- Status Bar Notification With Progress Bar"