Android-PanesLibrary icon indicating copy to clipboard operation
Android-PanesLibrary copied to clipboard

Force close (NullPointerException) when changing orientation

Open InfoSec812 opened this issue 12 years ago • 7 comments

When all that is being displayed fits on a single screen (in my case the menu and a first-level listview), changes in orientation have no problems. I get a NPE and forced close when I add a subsequent fragment and it would cause the panels to have more than a single screen's worth of fragments. The NPE is thrown when the "off screen" fragment tries to do anything on the UI thread.

This problem occurs on both a phone (Galaxy Nexus 4.1.2) and a tablet (HP TouchPad 4.0.4)

App code can be found at: https://github.com/dnsdotcom/DNSDroid

InfoSec812 avatar Feb 26 '13 10:02 InfoSec812

Ok, I think this might be fixed. Could you pull and double check?

cricklet avatar Feb 26 '13 18:02 cricklet

I did a pull and cleaned my projects and tried again. Still got the same result. Once I was 3 levels deep, changing the orientation still causes a force close. Thank you very much for getting back to me so quickly!!! Below you will find the relevant portions of the log:

02-26 13:52:41.941: D/HostsFragment(2021): Fragment loaded and now setting up UI. 02-26 13:52:41.941: D/AndroidRuntime(2021): Shutting down VM 02-26 13:52:41.941: W/dalvikvm(2021): threadid=1: thread exiting with uncaught exception (group=0x2b4ea1f8) 02-26 13:52:41.971: E/AndroidRuntime(2021): FATAL EXCEPTION: main 02-26 13:52:41.971: E/AndroidRuntime(2021): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dns.android.authoritative/com.dns.android.authoritative.Main_}: java.lang.NullPointerException 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2079) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3474) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.ActivityThread.access$700(ActivityThread.java:132) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.os.Handler.dispatchMessage(Handler.java:99) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.os.Looper.loop(Looper.java:137) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.ActivityThread.main(ActivityThread.java:4575) 02-26 13:52:41.971: E/AndroidRuntime(2021): at java.lang.reflect.Method.invokeNative(Native Method) 02-26 13:52:41.971: E/AndroidRuntime(2021): at java.lang.reflect.Method.invoke(Method.java:511) 02-26 13:52:41.971: E/AndroidRuntime(2021): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 02-26 13:52:41.971: E/AndroidRuntime(2021): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) 02-26 13:52:41.971: E/AndroidRuntime(2021): at dalvik.system.NativeStart.main(Native Method) 02-26 13:52:41.971: E/AndroidRuntime(2021): Caused by: java.lang.NullPointerException 02-26 13:52:41.971: E/AndroidRuntime(2021): at com.dns.android.authoritative.fragments.HostListFragment.setupUi(HostListFragment.java:91) 02-26 13:52:41.971: E/AndroidRuntime(2021): at com.dns.android.authoritative.fragments.HostListFragment_.afterSetContentView_(HostListFragment_.java:98) 02-26 13:52:41.971: E/AndroidRuntime(2021): at com.dns.android.authoritative.fragments.HostListFragment_.onCreateView(HostListFragment_.java:107) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1070) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1861) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.Activity.performStart(Activity.java:4475) 02-26 13:52:41.971: E/AndroidRuntime(2021): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2042) 02-26 13:52:41.971: E/AndroidRuntime(2021): ... 12 more

InfoSec812 avatar Feb 26 '13 18:02 InfoSec812

This could be related to how AndroidAnnotations handles portioning work between the foreground and the background. It may be trying to use a widget before the activity/fragment is fully resumed/created.

InfoSec812 avatar Feb 26 '13 19:02 InfoSec812

Cool, I'll check this out this weekend. I'm a little bit swamped until then :P

cricklet avatar Feb 28 '13 03:02 cricklet

No worries... Thanks for all of the help!

On Wed, Feb 27, 2013 at 10:56 PM, cricklet [email protected] wrote:

Cool, I'll check this out this weekend. I'm a little bit swamped until then :P

— Reply to this email directly or view it on GitHubhttps://github.com/Mapsaurus/Android-PanesLibrary/issues/4#issuecomment-14215491 .

InfoSec812 avatar Feb 28 '13 04:02 InfoSec812

Hey! Sorry this took forever for me to get around to this. With the most recent version of the library, I tried importing your project. I added a non-sense key in the first screen.

Then, from the side-menu, I clicked Domains (loading up an initial content fragment), then the '+' button (which adds a new fragment on top of it). Seems to work fine to me.

cricklet avatar Apr 03 '13 00:04 cricklet

I'll give it a shot as soon as I can. Thanks!

Deven On Apr 2, 2013 8:15 PM, "cricklet" [email protected] wrote:

Hey! Sorry this took forever for me to get around to this. With the most recent version of the library, I tried importing your project. I added a non-sense key in the first screen.

Then, from the side-menu, I clicked Domains (loading up an initial content fragment), then the '+' button (which adds a new fragment on top of it). Seems to work fine to me.

— Reply to this email directly or view it on GitHubhttps://github.com/Mapsaurus/Android-PanesLibrary/issues/4#issuecomment-15810781 .

InfoSec812 avatar Apr 03 '13 02:04 InfoSec812