I have a button on my application that triggers the camera and stores the image a directory of the SDCARD.
For some reason, the device "LG Optimus F5" error of this procedure. Already tested in a series of devices with different versions of Android, and this error does not occur. Does anyone know how to solve this problem?
My code is:
public void executeAction() {
if (Application.getInstance().getStatus() == AppStatus.ONLINE) {
fileUri = getOutputMediaFileUri("ImagePrisma3");
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivityForResult(intent, 0);
}
}
Post Execution:
protected void onPostExecute(Integer result) {
if (parameterValue.equals("1")) {
TxtRequester.setText(Application.getInstance().getUser());
} else {
TxtRequester.setText("");
}
loadWorkRequestTypeSpinner();
// loadWorkTypeSpinner();
if(progress.isShowing())
{
progress.dismiss();
progress = null;
}
}
The following exception is being thrown:
08-28 10:41:40.177: E/AndroidRuntime(8019): FATAL EXCEPTION: main
08-28 10:41:40.177: E/AndroidRuntime(8019): java.lang.IllegalArgumentException: View not attached to window manager
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:671)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:364)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:163)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.app.Dialog.dismissDialog(Dialog.java:361)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.app.Dialog.dismiss(Dialog.java:344)
08-28 10:41:40.177: E/AndroidRuntime(8019): at com.sisteplantbrasil.WorkRequestOpen$Processo.onPostExecute(WorkRequestOpen.java:239)
08-28 10:41:40.177: E/AndroidRuntime(8019): at com.sisteplantbrasil.WorkRequestOpen$Processo.onPostExecute(WorkRequestOpen.java:1)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.os.AsyncTask.finish(AsyncTask.java:631)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.os.AsyncTask.access$600(AsyncTask.java:177)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.os.Handler.dispatchMessage(Handler.java:99)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.os.Looper.loop(Looper.java:137)
08-28 10:41:40.177: E/AndroidRuntime(8019): at android.app.ActivityThread.main(ActivityThread.java:4904)
08-28 10:41:40.177: E/AndroidRuntime(8019): at java.lang.reflect.Method.invokeNative(Native Method)
08-28 10:41:40.177: E/AndroidRuntime(8019): at java.lang.reflect.Method.invoke(Method.java:511)
08-28 10:41:40.177: E/AndroidRuntime(8019): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
08-28 10:41:40.177: E/AndroidRuntime(8019): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
08-28 10:41:40.177: E/AndroidRuntime(8019): at dalvik.system.NativeStart.main(Native Method)
08-28 10:41:42.760: E/Trace(8298): error opening trace file: No such file or directory (2)