Android lock screen rotation -


i know can set screen layout portrait or landscape in activity's xml tag in manifest prevent screen rotation.

i have app shall run on phone , on tablet. on tablet want have landscape , on phone want have portrait mode. how can configuration? (and of course when device rotates screen shall not).

for check whether tab or not, can use simple method:

public boolean istablet(context context){ boolean xlarge = ((context.getresources().getconfiguration().screenlayout & configuration.screenlayout_size_mask) == 4); boolean large = ((context.getresources().getconfiguration().screenlayout & configuration.screenlayout_size_mask) == configuration.screenlayout_size_large); return (xlarge || large); } 

or

      public static boolean istablet(context context) {       return (context.getresources().getconfiguration().screenlayout         & configuration.screenlayout_size_mask)         >= configuration.screenlayout_size_large;       } 

both helpful you.

for more information, check conversation.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -