Android
Android

Reputation: 141

View application in landscape view?

At the time of button click I need to show my data in landscape view.
How to show the data in landscape view?

Upvotes: 0

Views: 365

Answers (2)

Primal Pappachan
Primal Pappachan

Reputation: 26545

Add the following line in the onClick event of the button.

yourActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

The constants that should be used are defined in the ActivityInfo class.

More info

Upvotes: 3

Al Sutton
Al Sutton

Reputation: 3924

The simplest method would be to use a separate Activity to display the data and in your manifest add the following attribute to the activities declaration;

android:screenOrientation="landscape"

You can find more information on that setting at http://developer.android.com/guide/topics/manifest/activity-element.html

Upvotes: 0

Related Questions