Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force close (NullPointerException) when changing orientation #4

Open
InfoSec812 opened this issue Feb 26, 2013 · 7 comments
Open

Force close (NullPointerException) when changing orientation #4

InfoSec812 opened this issue Feb 26, 2013 · 7 comments

Comments

@InfoSec812
Copy link

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

@cricklet
Copy link
Owner

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

@InfoSec812
Copy link
Author

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
Copy link
Author

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.

@cricklet
Copy link
Owner

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

@InfoSec812
Copy link
Author

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//issues/4#issuecomment-14215491
.

@cricklet
Copy link
Owner

cricklet commented Apr 3, 2013

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.

@InfoSec812
Copy link
Author

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//issues/4#issuecomment-15810781
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants