android Could not lock surface : dequeueBuffer failed (Unknown error 2147483646) - android

I am getting this error while navigating through my app.It happens every 5-10 transitions and restarts the app.
here is the exception i got while app crashes.
Please help me to solve the issue.
12-22 16:33:41.625: E/Surface(23199): dequeueBuffer failed (Unknown error 2147483646)
12-22 16:33:41.633: E/ViewRootImpl(23199): Could not lock surface
12-22 16:33:41.633: E/ViewRootImpl(23199): java.lang.IllegalArgumentException
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.Surface.nativeLockCanvas(Native Method)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.Surface.lockCanvas(Surface.java:243)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2461)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2435)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2279)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1909)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1019)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5725)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.Choreographer.doFrame(Choreographer.java:544)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.os.Handler.handleCallback(Handler.java:733)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.os.Handler.dispatchMessage(Handler.java:95)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.os.Looper.loop(Looper.java:136)
12-22 16:33:41.633: E/ViewRootImpl(23199): at android.app.ActivityThread.main(ActivityThread.java:5086)
12-22 16:33:41.633: E/ViewRootImpl(23199): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 16:33:41.633: E/ViewRootImpl(23199): at java.lang.reflect.Method.invoke(Method.java:515)
12-22 16:33:41.633: E/ViewRootImpl(23199): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-22 16:33:41.633: E/ViewRootImpl(23199): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-22 16:33:41.633: E/ViewRootImpl(23199): at dalvik.system.NativeStart.main(Native Method)
I googled it and came to some of the solutions but they are all about webview.I didn't used webview or SurfaceView in my app.
I have also tried "android:hardwareAccelerated="false" in manifest file but issue still persist.

It was Picasso causing this issue.I was allocating a new object of picasso.Using a Singleton Object of picasso solves the issue.

Related

Can't run FacePreview on android device

When you attempt to run the sample javacv 1.1 FacePreview (https://github.com/bytedeco/javacv/blob/master/samples/FacePreview.java) from eclipse error message:
12-22 21:54:10.439: E/AndroidRuntime(26606): FATAL EXCEPTION: main
12-22 21:54:10.439: E/AndroidRuntime(26606): Process: org.opencv.samples.facedetect, PID: 26606
12-22 21:54:10.439: E/AndroidRuntime(26606): java.lang.NoClassDefFoundError: Failed resolution of: Lorg/bytedeco/javacpp/Loader;
12-22 21:54:10.439: E/AndroidRuntime(26606): at org.opencv.samples.facedetect.FaceView.<init>(FdActivity.java:125)
12-22 21:54:10.439: E/AndroidRuntime(26606): at org.opencv.samples.facedetect.FdActivity.onCreate(FdActivity.java:98)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.app.Activity.performCreate(Activity.java:6021)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.app.ActivityThread.access$800(ActivityThread.java:155)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1323)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.os.Handler.dispatchMessage(Handler.java:102)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.os.Looper.loop(Looper.java:135)
12-22 21:54:10.439: E/AndroidRuntime(26606): at android.app.ActivityThread.main(ActivityThread.java:5376)
12-22 21:54:10.439: E/AndroidRuntime(26606): at java.lang.reflect.Method.invoke(Native Method)
12-22 21:54:10.439: E/AndroidRuntime(26606): at java.lang.reflect.Method.invoke(Method.java:372)
12-22 21:54:10.439: E/AndroidRuntime(26606): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
12-22 21:54:10.439: E/AndroidRuntime(26606): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
12-22 21:54:10.439: E/AndroidRuntime(26606): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.bytedeco.javacpp.Loader" on path: DexPathList[[zip file "/data/app/org.opencv.samples.facedetect-1/base.apk"],nativeLibraryDirectories=[/data/app/org.opencv.samples.facedetect-1/lib/arm, /vendor/lib, /system/lib]]
12-22 21:54:10.439: E/AndroidRuntime(26606): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-22 21:54:10.439: E/AndroidRuntime(26606): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-22 21:54:10.439: E/AndroidRuntime(26606): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
12-22 21:54:10.439: E/AndroidRuntime(26606): ... 15 more
12-22 21:54:10.439: E/AndroidRuntime(26606): Suppressed: java.lang.ClassNotFoundException: org.bytedeco.javacpp.Loader
12-22 21:54:10.439: E/AndroidRuntime(26606): at java.lang.Class.classForName(Native Method)
12-22 21:54:10.439: E/AndroidRuntime(26606): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
12-22 21:54:10.439: E/AndroidRuntime(26606): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
12-22 21:54:10.439: E/AndroidRuntime(26606): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
12-22 21:54:10.439: E/AndroidRuntime(26606): ... 16 more
12-22 21:54:10.439: E/AndroidRuntime(26606): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I did everything according to instructions https://github.com/bytedeco/javacv
tell me what could be the problem?
sorry for my English.
Thank you in advance!

On loading screen if orientation change then app crashes

I am facing some issue in login screen of my app, My app supports both orientation Portrait as well as landscape, in every condition it works good but when I click on Sign in button and on loading screen I change the orientation then app crashes...
I don't know where is the problem
here is error
12-22 14:29:51.559 W/Xamarin.Insights(11215): java.lang.IllegalArgumentException: View not attached to window manager
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:406)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:308)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.app.Dialog.dismissDialog(Dialog.java:323)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.app.Dialog.dismiss(Dialog.java:306)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at mono.java.lang.RunnableImplementor.n_run(Native Method)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.os.Handler.handleCallback(Handler.java:730)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.os.Handler.dispatchMessage(Handler.java:92)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.os.Looper.loop(Looper.java:137)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at java.lang.reflect.Method.invoke(Method.java:525)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at dalvik.system.NativeStart.main(Native Method)
12-22 14:29:51.656 D/dalvikvm(11215): GC_CONCURRENT freed 536K, 41% free 4454K/7484K, paused 2ms+2ms, total 52ms
An unhandled exception occured.
12-22 14:29:53.584 E/mono-rt (11215): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.IllegalArgumentException: View not attached to window manager
12-22 14:29:53.584 E/mono-rt (11215): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2098/3efa14c4/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
12-22 14:29:53.584 E/mono-rt (11215): at Android.Runtime.JNIEnv.CallVoidMethod (IntPtr jobject, IntPtr jmethod) [0x00062] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:554
12-22 14:29:53.584 E/mono-rt (11215): at Android.App.Dialog.Dismiss () [0x00043] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Dialog.cs:572
12-22 14:29:53.584 E/mono-rt (11215): at AndroidHUD.AndHUD+<DismissCurrent>c__AnonStorey4.<>m__0 () [0x0001c] in <filename unknown>:0
12-22 14:29:53.584 E/mono-rt (11215): at AndroidHUD.AndHUD+<DismissCurrent>c__AnonStorey4.<>m__1 (System.Object state) [0x00000] in <filename unknown>:0
12-22 14:29:53.584 E/mono-rt (11215): at Android.App.SyncContext+<Send>c__AnonStorey1.<>m__0 () [0x00000] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:32
12-22 14:29:53.584 E/mono-rt (11215): at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
12-22 14:29:53.584 E/mono-rt (11215): at Java.Lang.IRunnableInvoker.n_Run (IntPtr jnienv, IntPtr native__this) [0x00009] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Java.Lang.IRunnable.cs:71
12-22 14:29:53.584 E/mono-rt (11215): at (wrapper dynamic-method) System.Object:2491c231-85ea-488a-93d6-5c9d0adcdbd9 (intptr,intptr)
12-22 14:29:53.584 E/mono-rt (11215): --- End of managed exception stack trace ---
12-22 14:29:53.584 E/mono-rt (11215): java.lang.IllegalArgumentException: View not attached to window manager
12-22 14:29:53.584 E/mono-rt (11215): at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:406)
12-22 14:29:53.584 E/mono-rt (11215): at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:308)
12-22 14:29:53.584 E/mono-rt (11215): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)
12-22 14:29:53.584 E/mono-rt (11215): at android.app.Dialog.dismissDialog(Dialog.java:323)
12-22 14:29:53.584 E/mono-rt (11215): at android.app.Dialog.dismiss(Dialog.java:306)
12-22 14:29:53.584 E/mono-rt (11215): at mono.java.lang.RunnableImplementor.n_run(Native Method)
12-22 14:29:53.584 E/mono-rt (11215): at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
12-22 14:29:53.584 E/mono-rt (11215): at android.os.Handler.handleCallback(Handler.java:730)
12-22 14:29:53.584 E/mono-rt (11215): at android.os.Handler.dispatchMessage(Handler.java:92)
12-22 14:29:53.584 E/mono-rt (11215): at android.os.Looper.loop(Looper.java:137)
12-22 14:29:53.584 E/mono-rt (11215): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-22 14:29:53.584 E/mono-rt (11215): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 14:29:53.584 E/mono-rt (11215): at java.lang.reflect.Method.invoke(Method.java:525)
12-22 14:29:53.584 E/mono-rt (11215): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-22 14:29:53.584 E/mono-rt (11215): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-22 14:29:53.584 E/mono-rt (11215): at dalvik.system.NativeStart.main(Native Method)
12-22 14:29:53.584 E/mono-rt (11215):
12-22 14:29:53.622 W/Mono (11215): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-22 14:29:53.640 D/Mono (11215): Unloading image System.Core.dll [0x728112e8].
12-22 14:29:53.642 D/Mono (11215): Image addref System.Core[0x7435b280] -> System.Core.dll[0x6f1ab1f0]: 8
12-22 14:29:53.650 W/Mono (11215): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-22 14:29:53.654 D/Mono (11215): Unloading image System.Core.dll [0x727f41e0].
12-22 14:29:53.656 D/Mono (11215): Image addref System.Core[0x7435b280] -> System.Core.dll[0x6f1ab1f0]: 9
In mgmain JNI_OnLoad
Thank you
Use these code in the your Manifest.xml file (in your activity class) then the data will not change in the both modes (landscape or portrait).
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode
OR USE SIMPLY THESE
android:configChanges="orientation|screenSize|screenLayout"
java.lang.IllegalArgumentException: View not attached to window manager
Means your Progress dialog not dismissed completly. So you need to check whether its null or not and showing or not. Also put it with try....catch statement.
try {
if ((myDialog!= null) && myDialog.isShowing()) {
myDialog.dismiss();
}
} catch (final IllegalArgumentException e) {
// Handle or log or ignore
} catch (final Exception e) {
// Handle or log or ignore
} finally {
myDialog = null;
}

How to reproduce "createWindowSurface failed EGL_BAD_ALLOC" exception on my device?

ava.lang.RuntimeException: createWindowSurface failed EGL_BAD_ALLOC
at android.view.HardwareRenderer$GlRenderer.createSurface(HardwareRenderer.java:1387)
at android.view.HardwareRenderer$GlRenderer.createEglSurface(HardwareRenderer.java:1279)
at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:1096)
at android.view.HardwareRenderer.initializeIfNeeded(HardwareRenderer.java:605)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2596)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2430)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2005)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1076)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5905)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:807)
at android.view.Choreographer.doCallbacks(Choreographer.java:601)
at android.view.Choreographer.doFrame(Choreographer.java:562)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:791)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5633)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
at dalvik.system.NativeStart.main(NativeStart.java)
I am not using any OpenGl or anything of that sort. And hardwareAccelaration is also false

Integrated Crashlytics Kit failed with Android project

First of all, using Eclipse. It creates 4 projects(as libraries) after plugin installed and creates kit-libs with those 4 projects in my android-project. Then I built the project and the apk compiled successfully but ran failed. Failed log:
12-22 17:50:07.377: E/dalvikvm(8452): Could not find class 'io.fabric.sdk.android.Kit[]', referenced from method com.pplive.test.fabric.MainActivity.onCreate
12-22 17:50:07.377: W/dalvikvm(8452): VFY: unable to resolve new-array 650 ([Lio/fabric/sdk/android/Kit;) in Lcom/pplive/test/fabric/MainActivity;
12-22 17:50:07.377: D/dalvikvm(8452): VFY: replacing opcode 0x23 at 0x0004
12-22 17:50:07.377: D/dalvikvm(8452): DexOpt: unable to opt direct call 0x0ff0 at 0x09 in Lcom/pplive/test/fabric/MainActivity;.onCreate
12-22 17:50:07.383: D/AndroidRuntime(8452): Shutting down VM
12-22 17:50:07.383: W/dalvikvm(8452): threadid=1: thread exiting with uncaught exception (group=0x41be8930)
12-22 17:50:07.386: E/AndroidRuntime(8452): FATAL EXCEPTION: main
12-22 17:50:07.386: E/AndroidRuntime(8452): java.lang.NoClassDefFoundError: io.fabric.sdk.android.Kit[]
12-22 17:50:07.386: E/AndroidRuntime(8452): at com.pplive.test.fabric.MainActivity.onCreate(MainActivity.java:15)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.Activity.performCreate(Activity.java:5206)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-22 17:50:07.386: E/AndroidRuntime(8452): at com.lbe.security.service.core.client.internal.InstrumentationDelegate.callActivityOnCreate(InstrumentationDelegate.java:76)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2171)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread.access$600(ActivityThread.java:142)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1235)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.os.Looper.loop(Looper.java:137)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread.main(ActivityThread.java:5072)
12-22 17:50:07.386: E/AndroidRuntime(8452): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 17:50:07.386: E/AndroidRuntime(8452): at java.lang.reflect.Method.invoke(Method.java:511)
12-22 17:50:07.386: E/AndroidRuntime(8452): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:812)
12-22 17:50:07.386: E/AndroidRuntime(8452): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:579)
12-22 17:50:07.386: E/AndroidRuntime(8452): at dalvik.system.NativeStart.main(Native Method)
Do I need to modify the build path in property?
I found same issue couple of days ago, Yesterday I have resolved this issue by:
By compile my project using 1.7. As crashlytics compiled in 1.7
Installing build-tool 20 from sdk manager.
Hopes it worked for you too.

IllegalStateException after coming back to a FragmentActivity

this is about a recurrent problem that I discovered my application is facing and is related to the use of a couple of DialogFragments. I'm targeting mainly platform level 8 devices so to use DialogFragments I had to use the compatibility library.
The problem itself happens whenever I get out of the application and them come back. Here's the stacktrace:
12-22 14:56:05.819: W/dalvikvm(6384): threadid=1: thread exiting with uncaught exception (group=0x400207d8)
12-22 14:56:05.949: E/AndroidRuntime(6384): FATAL EXCEPTION: main
12-22 14:56:05.949: E/AndroidRuntime(6384): java.lang.IllegalStateException: Activity has been destroyed
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1269)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:541)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.app.BackStackRecord.commitAllowingStateLoss(BackStackRecord.java:529)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:102)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.view.ViewPager.populate(ViewPager.java:692)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:851)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.os.Looper.loop(Looper.java:123)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-22 14:56:05.949: E/AndroidRuntime(6384): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 14:56:05.949: E/AndroidRuntime(6384): at java.lang.reflect.Method.invoke(Method.java:521)
12-22 14:56:05.949: E/AndroidRuntime(6384): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
12-22 14:56:05.949: E/AndroidRuntime(6384): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-22 14:56:05.949: E/AndroidRuntime(6384): at dalvik.system.NativeStart.main(Native Method)
And here's my stripped-down-to-the-minimum MainActivity.
public class MainActivity extends FragmentActivity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
...
public void showNewChannelFragmentDialog() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
// Create and show the dialog.
NewChannelDialogFragment newFragment = NewChannelDialogFragment.newInstance();
newFragment.setContext(this);
newFragment.show(ft,"dialog");
}
}
The showNewChannelFragmentDialog() method is only called when the user selects a specific menu option, so I think the content of the DialogFragment itself is irrelevant here.
But you can see I do exactly what is shown here and it indeed works, the problem as I said earlier is whenever my application is being restored back to life once the user has left it.
Any suggestions? I'm considering dropping the fragments and just using regular Dialogs.
maybe it's not the one and only problem but you should call
ft.add(newFragment);
ft.commit(); //but at least this
at the end of your showNewChannelFragmentDialog() function.

Categories

Resources