Showing ProgressDialog during UI Thread operation in Android?

As discovered, the loop to work through the applications takes awhile (which can be done in a separate thread), compared to the call to PackageManager. GetInstalledPackages() (which has to be done on the UI thread).

Try the following for ProgressDialog in the onCreate() of your activity this. RequestWindowFeature(Window. FEATURE_INDETERMINATE_PROGRESS); ProgressDialog LoadingDialog = ProgressDialog.

Show(this, "", "Loading..", true); And then dismiss it when the process causing the delay is over LoadingDialog.dismiss().

Use Async to do background work and show indicator while loading data. In you onCreate(). Call new AsyncCommonDataFetcher(this).execute(); public class AsyncCommonDataFetcher extends AsyncTask { Context mContext = null; private ProgressDialog mProgressIndicator = null; public AsyncCommonDataFetcher(Context ctx) { mContext = ctx; } protected void onPreExecute() { mProgressIndicator = ProgressDialog.

Show(((Activity) mContext), null, "Please wait", true); } @Override protected Void doInBackground(Void... voids) { // Do what ever work you like to do. It will do this in backgound and show user a indicator to wait. } @Override protected void onPostExecute(Void voidInstance) { try { if (mProgressIndicator!

= null) { mProgressIndicator.hide(); mProgressIndicator.dismiss(); } } catch (Exception e2) { e2.printStackTrace(); } } } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions