1

I am trying to check if my android is tablet or not by detecting if it has speakerphone. please help.

public boolean isTablet(Context context) {
boolean xlarge = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE);
boolean large = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
return (xlarge || large);}

In samsung SGH I527M phone the method return true and its not a tablet. As I mantioned I just wanted to see if the device has earphone to listen through.

nobody
  • 19,814
  • 17
  • 56
  • 77
Eli Elezra
  • 525
  • 2
  • 4
  • 18
  • Possible duplicate of [Tablet or Phone - Android](http://stackoverflow.com/questions/5832368/tablet-or-phone-android) – TAM Mar 16 '16 at 13:50
  • Checking for speakerphone isn't a reliable way to tell about tablets. The question of detecing a tablet is extensively discussed e.g. in http://stackoverflow.com/questions/5832368/tablet-or-phone-android and other articles here. – TAM Mar 16 '16 at 13:52

1 Answers1

0

This is the best solution! Because thats check if it has radio phone so literaly if tou has radio tou have earphone.answer

Community
  • 1
  • 1
Eli Elezra
  • 525
  • 2
  • 4
  • 18