Questions tagged [android-screen]
233 questions
109
votes
4 answers
Lock Android phone application to Portrait mode
Can someone tell me how to lock my application to a portrait mode? Is it a simple configuration in the manifest file?

sexitrainer
- 1,347
- 2
- 12
- 18
83
votes
13 answers
How do I get the ScreenSize programmatically in android
Android defines screen sizes as Normal Large XLarge etc.
It automatically picks between static resources in appropriate folders. I need this data about the current device in my java code. The DisplayMetrics only gives information about the current…

user1454356
- 987
- 1
- 7
- 5
34
votes
7 answers
How to get android device screen size?
I have two android device with same resolution
Device1 -> resolution 480x800 diagonal screen size -> 4.7 inches
Device2 -> resolution 480x800 diagonal screen size -> 4.0 inches
How to find device diagonal screen size?
Detect 7 inch and 10 inch…

Kailas
- 3,173
- 5
- 42
- 52
29
votes
7 answers
How to prevent automatic screen lock on android by code?
In my app there is a long loading process, and if the devices puts on the screen lock, my process stops for some reason.
How can i prevent the device from automatic screen lock?

Adam Varhegyi
- 11,307
- 33
- 124
- 222
27
votes
4 answers
Android: Disable application for tablet
I developed an application, Now i want to restrict the application for tablet.
Means the application should not run on any tablets. For that I specify the support-screens in Androidmenifest.XML file as:

Manoj Fegde
- 4,786
- 15
- 50
- 95
26
votes
3 answers
Setting drawable folder to use for different resolutions
I have 4 different sizes for each of the icons I need to use in my app. The problem is My Nexus 7 (1280 x 800) and galaxy s2 (800 x 480) seem to use the resources in drawable-hdpi. How do I force the Nexus to use resources in drawable-xhdpi and then…

Amanni
- 1,924
- 6
- 31
- 51
24
votes
6 answers
Android DisplayMetrics returns incorrect screen size in pixels on ICS
I've tried this....
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int fullscreenheight = metrics.heightPixels;
int fullscreenwidth = metrics.widthPixels;
and....
Display display =…

dell116
- 5,835
- 9
- 52
- 70
23
votes
2 answers
How to find the device as LDPI MDPI HDPI or XHDPI
Without any code snippet for the application, how to get screen resolution and length of the screen. How could I find whether the device is ldpi, mdpi , hdpi or xhdpi ?

Sreeram
- 564
- 1
- 5
- 15
18
votes
2 answers
How to turn on and turn off screen with adb command?
I am using KEYCODE_POWER to turn on and turn off my rooted phone. The bellow command is used in both case turn on and turn off the screen.
adb shell input keyevent KEYCODE_POWER
However, I want to use it in separated cases: turn on and turn off. I…

John
- 2,838
- 7
- 36
- 65
18
votes
5 answers
Android: Samsung Galaxy S3 screen size for layout
Is anyone out there testing on a Samsung Galaxy S3 yet?
Specifically, does it have what is considered a large or normal screen for layout purposes?
I have the Galaxy Nexus and it takes normal layouts, but I read the Galaxy Note is considered a…

rustyWhitefeather
- 400
- 1
- 3
- 12
16
votes
1 answer
Marking cursor Clicks/Taps/Double Taps in Android Studio Screen Recorder
Android Screen Recorder is a great tool for capturing the Android Screen but is there a way to highlight the clicks and Taps as well while we navigate the App on the Android Phone/Emulator screen?

Raulp
- 7,758
- 20
- 93
- 155
15
votes
1 answer
Android : App support for multiple tablet screen resolutions
I just ran my Android application on Galaxy Tab Emulator, where the design looks distracted. Now my worry is how to make the app fit perfectly on all the Tablet Screens. Since I came acrosss diffrent screen resolutions for Android Tablets.
For…

Vinayak Bevinakatti
- 40,205
- 25
- 108
- 139
14
votes
2 answers
Find exact coordinates of a single Character inside a TextView
Currently I'm using paintObject.measureText(textCopy.substring(0,i)) while iterating through a copy of the TextView's text. For example, measureText("abc".substring(0,1)) will give me the relative x coordinates of 'b'. The y coordinate I get from…

Igor
- 1,253
- 1
- 25
- 34
14
votes
4 answers
Different design for landscape and portrait orientation android
Can we have a different xml for landscape and different xml for portrait orientation?
I am working on a simple app, have few buttons and textviews, the xml looks good in portrait, But with same xml when I check the landscape orientation, design…

Adarsh H S
- 1,208
- 6
- 21
- 42
13
votes
1 answer
How to lock/unlock the screen with Pattern/Password mode in Android?
I was successful to lock/unlock my screen using DevicePolicyManager and KeyguardManager in Android L. It worked well when I lock/unlock screen using swipe mode (no security). However, I cannot lock/unlock it when I lock/unlock screen by using…

user3051460
- 1,455
- 22
- 58