Android: Disable application for tablet

This prevents access on tablets, but allows the new density buckets (xxhdpi and xxxhdpi) and avoids errors on projects that are compiled against lower SDKs. It should be a direct child of the <manifest> element in AndroidManifest.xml <compatible-screens> <!– all small size screens –> <screen android:screenSize=”small” android:screenDensity=”ldpi” /> <screen android:screenSize=”small” android:screenDensity=”mdpi” /> <screen android:screenSize=”small” android:screenDensity=”hdpi” … Read more

How to get appropriate images in respective android Device in Android Studio

You have to follow this to support multiple devices : changes in screen density. xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp Make this layout files, so that it will be … Read more

How to restrict app to Android phones only

Because of the high densities of new devices such as Nexus 5X, Nexus 6P and the Samsung Galaxy S6 we had to adapt the manifest as following: <compatible-screens> <screen android:screenSize=”small” android:screenDensity=”ldpi” /> <screen android:screenSize=”small” android:screenDensity=”mdpi” /> <screen android:screenSize=”small” android:screenDensity=”hdpi” /> <screen android:screenSize=”small” android:screenDensity=”xhdpi” /> <screen android:screenSize=”small” android:screenDensity=”420″ /> <screen android:screenSize=”small” android:screenDensity=”480″ /> <screen android:screenSize=”small” android:screenDensity=”560″ … Read more

Supporting multiple screen size – Android

I just did something very similar. To stretch the app without creating new layouts I used dimensions set in XML res/values/dimensions.xml res/values-sw600dp/dimensions.xml -> 7+ inches res/values-sw720dp/dimensions.xml -> 10+ inches Dimensions are resources files: <dimen name=”default_padding”>11dp</dimen> You can increase the dimensions by about 30% in the 600 and 720 file. Then simply used @dimen/default_padding in your … Read more

Setting drawable folder to use for different resolutions

How do I force the Nexus to use resources in drawable-xhdpi and then the 10 inch tab to use drawable-xxhdpi? You can’t. The qualifiers hdpi,xhdpi,xxhdpi describes the screen density of the device, not the size of screen. From the official doc Screen density The quantity of pixels within a physical area of the screen; usually … Read more

Scale factor for xxhdpi android?

In android.util.DisplayMetrics, you can see that scaling factor is 0.00625: /** * Scaling factor to convert a density in DPI units to the density scale. * @hide */ public static final float DENSITY_DEFAULT_SCALE = 1.0f / DENSITY_DEFAULT; Where as DENSITY_DEFAULT is 160 –> scaling factor = 1.0f / 160 = 0.00625. sizeScale = DENSITY_DEFAULT_SCALE * … Read more