razorMC
razorMC

Reputation: 3

Switching orientation in Android

i have any troubles with switching between orientation from portrait to landscape.

i made this page cause i don't have permission to add images

http://www.guitart.comyr.com/

There are my codes and two images.

I've tried to make some small application to test switching, i made same folders as you can see at the page and this small test app works fine. But my original app doesnt work.

Sorry for English.

Upvotes: 0

Views: 90

Answers (3)

Simon Schubert
Simon Schubert

Reputation: 2028

Do you have

<Button
   android:id="@+id/btn_menu_info"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_alignParentRight="true"
   android:layout_alignParentTop="true"
   android:background="@drawable/info64"
   android:src="@drawable/info64" />

in both menu.xml layouts(layout|layout-land) folders? If you change the orientation to landscape, your app automatically uses the xmls from your layout-land folder. Eclipse don't recognize if the ID exists in both orientations. Eclipse can't stop you from building because it's no error but it could at least give you a warning imo.

No problem :)

Upvotes: 1

SKK
SKK

Reputation: 5271

Have you tried to just copy the layout file from layout folder and paste it in "layout-land". check the id's of the views because logcat is showing nullPointerException in onCreate.

Upvotes: 1

Nirav Tukadiya
Nirav Tukadiya

Reputation: 3427

<Button
        android:id="@+id/btn_menu_info"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:background="@drawable/info64"
        android:src="@drawable/info64" />

remove

android:src="@drawable/info64"

line from this button's property.thats the problem.and you are done.

Upvotes: 0

Related Questions