Boy, you are kind of making this hard to sort out ;)  What is the name of 
the AsyncTask subclass?

It looks to me as if the variable "pd" is assigned different dialogs at 
different times?  What is the value of the variable "activity" when 
onPreExecute is called?   ...and, it seem that you've posted two different 
implementations of onPreExecute?

It looks to me as if one of those dialogs is being created when the context 
is null, or at least invalid.  I totally cannot figure out, from the 
fragments you've posted, though, why that is.

G. Blake Meike
Marakana

The second edition of Programming Android is now on-line:
http://shop.oreilly.com/product/0636920023005.do



On Monday, June 25, 2012 9:19:41 AM UTC-7, Mahmoud Emam wrote:
>
> 06-25 15:03:02.596: E/WindowManager(29217):     at 
> com.android.grad.PreviewActivity$1.onClick(PreviewActivity.java:36)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> android.view.View.performClick(View.java:3527)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> android.view.View$PerformClick.run(View.java:14234)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> android.os.Handler.handleCallback(Handler.java:605)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> android.os.Handler.dispatchMessage(Handler.java:92)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> android.os.Looper.loop(Looper.java:137)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> android.app.ActivityThread.main(ActivityThread.java:4441)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> java.lang.reflect.Method.invokeNative(Native Method)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> java.lang.reflect.Method.invoke(Method.java:511)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
>     06-25 15:03:02.596: E/WindowManager(29217):     at 
> dalvik.system.NativeStart.main(Native Method)
>     06-25 15:03:04.186: I/Process(29217): Sending signal. PID: 29217 SIG: 9
>     06-25 15:03:04.566: D/TextLayoutCache(29339): Using debug level: 0 - 
> Debug Enabled: 0
>     06-25 15:03:04.606: D/libEGL(29339): loaded 
> /system/lib/egl/libGLES_android.so
>     06-25 15:03:04.606: D/libEGL(29339): loaded 
> /system/lib/egl/libEGL_adreno200.so
>     06-25 15:03:04.636: D/libEGL(29339): loaded 
> /system/lib/egl/libGLESv1_CM_adreno200.so
>     06-25 15:03:04.636: D/dalvikvm(29339): GC_CONCURRENT freed 117K, 3% free 
> 9125K/9351K, paused 4ms+17ms
>     06-25 15:03:04.636: D/libEGL(29339): loaded 
> /system/lib/egl/libGLESv2_adreno200.so
>     06-25 15:03:04.706: D/OpenGLRenderer(29339): Enabling debug mode 0
>     06-25 15:03:07.326: D/OpenGLRenderer(29339): Flushing caches (mode 0)
>     06-25 15:03:07.326: W/IInputConnectionWrapper(29339): showStatusIcon on 
> inactive InputConnection
>     06-25 15:03:07.366: D/OpenGLRenderer(29339): Flushing caches (mode 1)
>
> I know that this error asked before and i saw the solutions for that but 
> the solutions don't work with me. and this is my code.
>
> The error appear on pd.show().
>
> @Override
> protected void onPreExecute() {
>     //network.loadData();
>     file = new File(
>             Environment
>                     
> .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
>             "MyCameraApp" + File.separator + "project");
>     createProgressDialog();
>     pd.show();
> }
>
> @Override
> protected Boolean doInBackground(String... params) {
>     try {
>         crop = new Crop(params[0]);
>         crop.cropID();
>         croppedID = crop.getId();
>         publishProgress(2);
>     } catch (IOException e) {
>     }
>
>     segmentNumbers();
>     return true;
> }
>
> @Override
> protected void onProgressUpdate(Integer... values) {
>     pd.incrementProgressBy(values[0]);
> }
>
> @Override
> protected void onPostExecute(Boolean result) {
>     pd.dismiss();
>     Toast.makeText(activity, "Processing Done", Toast.LENGTH_LONG).show();
> }
>
> private void createProgressDialog() {
>     pd = new ProgressDialog(activity);
>     pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
>     pd.setTitle("Extract ID");
>     pd.setMessage("Processing...");
>     pd.setIcon(R.drawable.ic_launcher);
>     pd.setProgress(0);
>     pd.setCancelable(false);
> }
>
> onpreExecution method :- i am showing my dialog. doInBackGround method :- 
> I execute my segmentNumber() which used to segement picture. 
> onPostExecution method :- I am dismissing my dialog.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to