Detecting whether Android device is a phone or a tablet using code -


i did 1 application both mobile , tablet. here want visible few of contents on mobile not in tablet.

how can detect whether android device phone or tablet while launching activity.

i google , find out few suggestions user -agent.. how can use or other solutions??

thanks in advance...

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

this returne true if tablet or false if mobile


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -