Matthew Lueder Matthew Lueder - 1 year ago 86
Android Question

How to start a new activity when screen orientation changes? Android

I am writing an application which in portrait view has a gallery at the top and when you click a picture it will inflate and fill the entire screen.

This works however in landscape mode the gallery covers up most of the picture and it in general looks crappy.

I made a GridView for landscape mode. The problem I am having now is to change it from the gallery activity to the Gridview activity when the orientation changes. Any ideas?

Answer Source

Add this to your Activity:

public void onConfigurationChanged(Configuration newConfig) {


Note that this is a bad idea. Actually, it's a really bad idea. A much better alternative would be to either force one orientation or to create a layout that looks great on both orientations.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download