android-5.0-lollipop

SwitchPreference Callback behaviour change in lollipop

谁都会走 提交于 2019-12-10 11:17:46
问题 In our project we are using SwitchPreference similar to wifi settings.user can toggle value by clicking on toggle button and user can see more options by clicking on title. But this is not working in lollipop. I can see some behaviour change in lollipop. In kitkat: When user taps on toggle button, onPreferenceChanged callback is called and when user taps on title, onPreferenceClicked is called. In lollipop: you tap on toggle button or title onPreferenceClicked is called always and after that

Layout Alignment Issue in android 5.0

荒凉一梦 提交于 2019-12-10 10:55:21
问题 I have a layout in which a button is aligned at the bottom of the RelativeLayout as in below code : <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="250dp" android:background="@color/background_material_light" android:layout_height="match_parent"> <View android:layout_alignParentLeft="true" android:layout_width="1dp" android:layout_height="match_parent" android:background="

Check Android user's “when device is locked” notification settings

我的未来我决定 提交于 2019-12-10 08:51:56
问题 On Android L, I would like show the user a notification on the lock screen only if the user settings is set to "show all notification content", otherwise the content will be pointless and I just prefer not to show the notification at all. Any idea how to verify in code the user notification settings? Thanks! 回答1: You need to read Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = "lock_screen_allow_private_notifications" Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS = "lock_screen

Can't get rid of shadow under Android Button

痴心易碎 提交于 2019-12-10 06:18:21
问题 I have a Android Button that I'm placing on my screen, and am defining a custom background drawable that just specifies a green rectangle for now. But, for some reason there appears to be a very thin shadow being drawn under my button (highlighted with the red box): Is there any way to get rid of this while still using a Button? It because really ugly when I change my background drawable to have rounded corners. Thanks! 回答1: @alanv's comment was the correct answer: "On Material you need to

Android (Lollipop) EditText onFocus fired multiple times

纵饮孤独 提交于 2019-12-10 06:18:16
问题 I have a couple of EditTexts with onFocusChangeListeners // When the field gains or loses focus txtMinimumValue.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { editFocusChange(view, hasFocus); } }); I'm not having any issues on pre-Lollipop devices, but any Nexus 5's and the onFocusChange is fired about 7 times. I found this SO: Custom ListAdapter consisting of EditText lose focus called twice and then I found this

Why is it possible on Android 5 (Lollipop) to directly change UI views from other threads?

五迷三道 提交于 2019-12-10 04:27:41
问题 Consider the following code: new Thread() { @Override public void run() { myTextView.setText("Some text"); } }.start(); On pre-Lollipop androids, that code causes the CalledFromWrongThreadException exception, but why does it work fine on Lollipop androids? Testing environment: Genymotion emulator running Android 5.1 The code was inside the onCreateView() method of the Fragment class. 回答1: It's a matter of timing, for example inserting your code in onCreate() would not crash the app on Samsung

Is it possible to have a “Profile Owner” app in Android Lollipop that is not co-present

故事扮演 提交于 2019-12-10 03:54:12
问题 The Lollipop API provides 2 new features "Profile Owner" and "Device Owner" (http://developer.android.com/about/versions/android-5.0.html#Enterprise). Between them, they offer just the features I need for an app that parents can use to control their children's device activity. The setup flow for each is: Device Owner During device setup, using NFC, you can tell Android that you want your app to be a Device Owner. Android then downloads the app from a URL, and the device is encrypted and is

EditText input type textCapSentences not working on Lollipop

拈花ヽ惹草 提交于 2019-12-10 01:08:29
问题 I have implemeted android:inputType="textAutoComplete|textCapSentences" in my xml code. When I run it on kitkat , textCapSentence works fine but when build is run on Lollipop device it does not work. Anybody knows how to solve it. 回答1: Hi this is because in lollipop if you have disabled Auto - Capitalization in keyboard settings then you can't enable it programmatically. here are the steps:- Tap icon of ‘Settings’ on the Home screen of your Android Lollipop Device At the ‘Settings’ screen,

Getting only once permission for sdcard window on Lollipop and above version

大城市里の小女人 提交于 2019-12-09 19:57:26
问题 Hello I am deleting some items from SD card. And in lollipop first time i ask for permission and user grant permission, but now i don't want to ask every time for permission. Its very irritating and many of guys they afraid from this behavior. How can i save my permission i.e. next time i don't need to pass that Intent again and again Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); Thank you 回答1: I give you some code to example. Remember that u need check permission on Android 6

Recording 60fps video with Camera2(on Android version 21) API

梦想的初衷 提交于 2019-12-09 13:49:39
问题 I'm trying to record a video at 60(or more)fps rate on Camera2(android.hardware.camera2) APIs. Finally, I succeeded recording at 120fps using CameraConstrainedHighSpeedCaptureSession. But it is only targeted at >=120fps use case not for 60fps. Even I tried to record at 60fps using normal capture session(CameraCaptureSession), it only supports <=30fps. I could figure it out through this code below. Range<Integer>[] fpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE