App error when trying to launch in landscape mode


#1

Everytime I went to launch my app in landscape mode it would crash…so i flipped the emulator back to portrait, ran my app, and rotated…crash…

Seem’s that I was still working with the geoquiz challenges from chapter 2…

I ended up fixing my crashed by removing the ImageButtons, and going back to a Button…I still can’t wrap my head around why my app crashes if I use ImageButton’s in my FramLayout…can anyone shed some light?


#2

[quote=“donzavitz”]Everytime I went to launch my app in landscape mode it would crash…so i flipped the emulator back to portrait, ran my app, and rotated…crash…

Seem’s that I was still working with the geoquiz challenges from chapter 2…

I ended up fixing my crashed by removing the ImageButtons, and going back to a Button…I still can’t wrap my head around why my app crashes if I use ImageButton’s in my FramLayout…can anyone shed some light?[/quote]

I am also currently learning Android from this book but I am not having any crash issues while rotating my GeoQuiz App with ImageButtons.
I too have two imagebuttons (prev and next)


#3

I was getting a crash also, but then i realized instead of:

if (savedInstanceState != null) {
mCurrentIndex = savedInstanceState.getInt(KEY_INDEX, 0);
}

i had:

if (KEY_INDEX != null) {
mCurrentIndex = savedInstanceState.getInt(KEY_INDEX, 0);
}