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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -