9

My app has to support landscape/portrait mode only for tablets, phones will only support portrait mode. What is the best way to implement this?

Options that I am considering:

a) using two apk files, one for phones and one for tablets. The one for phone will lock landscape mode in the manifest

2) using one apk file. Detect that device is a phone, lock landscape mode inside each activity.

any advice will be appreciated.

Regards

omega
  • 630
  • 1
  • 6
  • 16
  • I had the same issue, and just wrote a blog entry on this subject, where I give three different solutions. http://androidblogger.blogspot.com/2011/08/orientation-for-both-phones-and-tablets.html – alocaly Aug 10 '11 at 01:03
  • Use [Fragments API](http://developer.android.com/guide/topics/fundamentals/fragments.html), it was design to handle such problems efficiently. – Vladimir Ivanov Apr 26 '11 at 09:51
  • the app is almost done. Fragments would require to redo the UI. This is not an option. Thanks – omega Apr 26 '11 at 10:49
  • This solution worked for me: https://stackoverflow.com/a/60381441/7826494 – David Elmasllari Sep 14 '21 at 15:06

1 Answers1

3

You can use a SuperClass for activities and implement this https://stackoverflow.com/a/9629127/710162 on, for example, onCreate().

Community
  • 1
  • 1
Daniel Argüelles
  • 2,229
  • 1
  • 33
  • 56