android-screen

changing brightness from Service android

陌路散爱 提交于 2019-12-11 02:19:57
问题 I want to change brightness of android device from a service. I have seen a lot of questions on stack overflow on this but none of them has solved my problem. I have done every thing from setting brightness in settingsManger, starting a new activity etc but none of them is working for me. 回答1: try as android.provider.Settings.System.putInt(getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS, BRIGHTNESS_Value); and add permission in Manifest.xml <uses-permission android

Capture android screen [duplicate]

亡梦爱人 提交于 2019-12-11 00:23:58
问题 This question already has answers here : Screen Capture in android (4 answers) Closed 4 years ago . How can I programmatically perform a screen capture on an Android phone? 回答1: You cannot do this from an android app except on a rooted phone, as you don't have permission to access the framebuffer device. You can however do it over adb from the DDMS window of your development machine, as adb runs in the graphics group which has permission to the framebuffer. If you want to do something similar

Android - Screen Resolution and Screen Density

吃可爱长大的小学妹 提交于 2019-12-10 09:21:58
问题 As per managing resources(images) in > Android 1.6 version, we need to keep different-resolutions image in Drawable-Hdpi, Drawable-Mdpi, Drawable-Lpi folder particularly. And as per this page: http://developer.android.com/guide/practices/screens_support.html , In Low density section - there are three resolutions used: 240*320 , 240x400 , 240x432 for the Small screen, Normal Screen, Large Screen particularly. same way for Medium density section - there are three resolutions used: 320x480 ,

Screen resolution / Physical size

十年热恋 提交于 2019-12-08 14:07:09
问题 I'm implementing an app for Android(API 10). I have few designs for tablet(supposedly) and for mobile phone. Regarding the previous sentence it might sound a bit stupid: in my opinion layouts should be picked according to device's physical size - not resolution, otherwise there might be a phone with high resolution that renders, say, a grid of 5x5, in rather confusing, inadequately small-sized way. In order to provide division by physical size I gotta use /res/layout- * folders. Agreed ? Also

Issue with DP calculation on 7“ tablet & 7” tablet emulator

醉酒当歌 提交于 2019-12-07 22:55:06
问题 I am having some problems with the dp calculation for a 7" tablet (800x480px). Below is my way of calculating. Can't find where I am making a mistake in calculation or my thought: I have three devices that I'm testing: Nexus One: 800x480px, 3.7" display (specs) Huawei Ideos: 320x240px, 2.8" display (specs) Ainol Novo 7" Tablet: 800x480px, 7" display (specs) Based on the display size, I'm calculating the DPI (dots per inch) manually, based on the formular: sqrt(w^2 + h^2) / in So I am getting:

How to position the view with margin that will look same for all devices?

核能气质少年 提交于 2019-12-06 17:06:10
问题 I'm trying to position a view in the center to make it look good by adding 130 (margin-top) programmatically, however, I'm not sure how to give other android devices such as tablets to look the same? adding 130 to the margin-top looks good on the normal android phone but will look different on a tablet. How will I able to make a logic to give a margin-top that will provide the same look on all devices? Some examples or tip would be great! I would love to hear from you! margin_top = 130 // How

Android - Screen Resolution and Screen Density

白昼怎懂夜的黑 提交于 2019-12-05 13:55:06
As per managing resources(images) in > Android 1.6 version, we need to keep different-resolutions image in Drawable-Hdpi, Drawable-Mdpi, Drawable-Lpi folder particularly. And as per this page: http://developer.android.com/guide/practices/screens_support.html , In Low density section - there are three resolutions used: 240*320 , 240x400 , 240x432 for the Small screen, Normal Screen, Large Screen particularly. same way for Medium density section - there are three resolutions used: 320x480 , 480x800 , 480x854 for the Small screen, Normal Screen, Large Screen particularly. and same way for High

How to position the view with margin that will look same for all devices?

无人久伴 提交于 2019-12-04 22:26:09
I'm trying to position a view in the center to make it look good by adding 130 (margin-top) programmatically, however, I'm not sure how to give other android devices such as tablets to look the same? adding 130 to the margin-top looks good on the normal android phone but will look different on a tablet. How will I able to make a logic to give a margin-top that will provide the same look on all devices? Some examples or tip would be great! I would love to hear from you! margin_top = 130 // How to make this look good on all devices? ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams)

Why camera2 supported preview size width always bigger than height?

这一生的挚爱 提交于 2019-12-04 05:25:14
问题 I'm working on a project which using camera2 API. When I get the list of supported output preview size using: StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); Size[] choices = map.getOutputSizes(SurfaceTexture.class); the output size list always return values which have width>height despite the fact that screen's width When I use getResources().getDisplayMetrics() (or any similar method) to check width/height it's always return width And

How to dim screen to zero without conflicting with FLAG_KEEP_SCREEN_ON

爱⌒轻易说出口 提交于 2019-12-04 03:40:55
问题 I found several methods to dim the screen but I am unsure how they work in concert with FLAG_KEEP_SCREEN_ON: Settings.System.SCREEN_BRIGHTNESS IHardwareService.setScreenBacklight() WindowManager.LayoutParams.screenBrightness Which of the above methods will keep the screen on, even if I set brightness to 0.0 ? 回答1: Nothing will work reliably. If you set the brightness to 0 on some devices it will turn off the screen (but the device will be in a funny state for about 5 seconds or so before