Sunday, April 28, 2013

[android help] How can I detect current device is Android Tablet?


Your Galaxy Tab is running Honeycomb or higher, which means that the old Options Menu has been deprecated in favor of Action Bar. That having been said, there's still a menu icon in the title bar (a square with a slash through it in Honeycomb and three square dots in Jelly Bean). If your user clicks that, they get your standard options menu (without menu item icons, however).


The alternative is to run ActionBar Sherlock to give your apps action bars, regardless of OS version.


If you insist on doing your own branching based on OS version, try this:



int sdk = android.os.Build.VERSION.SDK_INT;

if(sdk < android.os.Build.VERSION_CODES.HONEYCOMB)
{
// Gingerbread and earlier
}
else
{
// Honeycomb and later
}


.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...