Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your code is working fine but can you check that control are reaching in Post <code>onPostExecute()</code> method I have tried as </p> <pre><code> package com.alarm.activity; import android.app.Activity; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; public class AlarmManagerActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //set up main content view setContentView(R.layout.main); new DownloadAsyncTask().execute(); } /** * Download images from server */ public class DownloadAsyncTask extends AsyncTask&lt;Void, Integer, Void&gt; { private ProgressDialog mDialog; // execution of result of Long time consuming operation @Override protected void onPostExecute(Void result) { // progressDialog.show(); if (mDialog.isShowing()) { mDialog.dismiss(); } } // Things to be done before execution of long running operation. @Override protected void onPreExecute() { mDialog = ProgressDialog.show(AlarmManagerActivity.this, "Hello", "Test"); } // perform long running operation operation @Override protected Void doInBackground(Void... params) { //System.out.println("doInBackground loading.." + id); /* String tempPath = FileUtils.createTempFile(id); for (int i = 0; i &lt; imagePaths.size(); i++) { imagePaths.get(i).trim(); try { Bitmap imgTemp; imgTemp = FileUtils.downloadBitmapFromURL(id, imagePaths.get(i), tempPath); System.out.println("imgTemp: " + imgTemp); if (imgTemp != null) { // save image on sdcard. // compress it for performance Bitmap img = Bitmap.createScaledBitmap(imgTemp, 90, 80, true); imgTemp.recycle(); FileUtils.saveDataToFile(img, tempPath, imagePaths.get(i)); } else { continue; } } catch (IOException e) { e.printStackTrace(); mDialog.dismiss(); } } Looper.prepare(); mDialog.dismiss();*/ try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } /* * Things to be done while execution of long running operation is in * progress. */ @Override protected void onProgressUpdate(Integer... values) { if (mDialog.isShowing()) { mDialog.dismiss(); } } } } </code></pre> <p>I think problem in <code>doInbackground()</code> method. I have simply run thread for sleep 5 sec and after control reaches in <code>post()</code> method and dissmiss progress dialog.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload