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

crash when going from landscape to vertical mode everywhere #19

Open
erg opened this issue Mar 5, 2014 · 4 comments
Open

crash when going from landscape to vertical mode everywhere #19

erg opened this issue Mar 5, 2014 · 4 comments

Comments

@erg
Copy link
Owner

erg commented Mar 5, 2014

Start program in landscape mode, turn to vertical, crash.

  • already logged in state
03-04 21:34:00.825: E/AndroidRuntime(27088): FATAL EXCEPTION: main
03-04 21:34:00.825: E/AndroidRuntime(27088): Process: com.codepath.caltraindating, PID: 27088
03-04 21:34:00.825: E/AndroidRuntime(27088): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.codepath.caltraindating/com.codepath.caltraindating.MainActivity}: java.lang.NullPointerException
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.ActivityThread.access$900(ActivityThread.java:135)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.os.Handler.dispatchMessage(Handler.java:102)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.os.Looper.loop(Looper.java:136)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.ActivityThread.main(ActivityThread.java:5017)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at java.lang.reflect.Method.invokeNative(Native Method)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at java.lang.reflect.Method.invoke(Method.java:515)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at dalvik.system.NativeStart.main(Native Method)
03-04 21:34:00.825: E/AndroidRuntime(27088): Caused by: java.lang.NullPointerException
03-04 21:34:00.825: E/AndroidRuntime(27088):    at com.codepath.caltraindating.fragments.CheckinFragment.initRecentTrains(CheckinFragment.java:237)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at com.codepath.caltraindating.fragments.CheckinFragment.onCreateView(CheckinFragment.java:87)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1065)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1844)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:519)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.Activity.performStart(Activity.java:5241)
03-04 21:34:00.825: E/AndroidRuntime(27088):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
03-04 21:34:00.825: E/AndroidRuntime(27088):    ... 12 more
@erg erg added the crash label Mar 5, 2014
@erg
Copy link
Owner Author

erg commented Mar 5, 2014

Need to fix this by the method he mentioned in class, some or all of these:

landscape
- onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState)
}
onRestoreInstanceState

http://stackoverflow.com/questions/4096169/onsaveinstancestate-and-onrestoreinstancestate

onPostCreate
onConfigurationChange

@tristan-meng
Copy link
Collaborator

Seems the listener is null out when the configuration (portrait - landscape) changes.

@erg
Copy link
Owner Author

erg commented Mar 5, 2014

We could just force it to be portrait mode all the time as an easy fix (?)

@tristan-meng
Copy link
Collaborator

That's a good idea

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

No branches or pull requests

2 participants