android-5.0-lollipop

SwitchCompat not showing thumb image on Android 5.0 lollipop emulator

为君一笑 提交于 2019-12-06 08:27:24
问题 I read about the new SwitchCompat that has been introduced to implement the Switch widget in Android 5.0. I tried using the same but I am not able to see the drawable thumb image as seen in below image. My XML code is as follows, <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout

Set a theme on a View programmatically on Android 5.0 Lollipop

跟風遠走 提交于 2019-12-06 08:20:46
问题 Android 5.0 Lollipop added the ability to set a theme for different views (not just the Activity). android:theme="@style/MyAwesomeTheme" Is there a way to set the theme on a view dynamically? 回答1: android:theme changes specific attributes specified in the theme resource. You could instantiate specific view using any overloaded constructor, like View(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) . which basically is what inflater does. For example v7.widget.Toolbar

UnsatisfiedLinkError when compiling with API21

霸气de小男生 提交于 2019-12-06 07:31:58
My project uses NDK r10d for the c++ code. When I compile the project with API19 it works great, but when I compile it with API21 it crashes on runtime. When the c lib is loaded I get: dlopen("/data/app-lib/com.my.app-2/libMyCode.so") failed: dlopen failed: cannot locate symbol "stpcpy" referenced by "libMyCode.so"... Then it crashes on: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "stpcpy" referenced by "libMyCode.so"... I use OnePlus One running Android4.4.4 to test it on both cases. Any ideas? mstorsjo Yes - the android libc headers have changed in API 21. Some

Android L — Play Ripple Effect on View

十年热恋 提交于 2019-12-06 07:14:40
I am trying to play a ripple effect (from Android L) on a view at a certain time (not on the view being touched). To be specific, when the user successfully changes some text, I want a certain view to play a green ripple effect to show success. Is there any way to do this? I have tried putting a RippleDrawable in an Animation, putting the RippleDrawable as the background for my "success view." But, I can't figure out how to play the ripple animation as I have described. P.S. My project is Android L only right now, so I am not worried about backwards compatibility. Since your mask is just a

How to check permission SYSTEM_ALERT_WINDOW is granted on Android Lollipop?

血红的双手。 提交于 2019-12-06 07:04:34
问题 Note that I'm talking about Android Lollipop . For android 6.0 we can use method canDrawOverlays() to check that SYSTEM_ALERT_WINDOW is granted or not. With Android Lollipop, almost devices grant this permission by default. But on some devices of Xiaomi, Meizu.. it is not granted. Users need to go to the App info to allow it. How can we check it programmatically to warn users? 回答1: in MIUI use public static boolean isMiuiFloatWindowOpAllowed(@NonNull Context context) { final int version =

Service is not waking up device as it should

孤者浪人 提交于 2019-12-06 06:40:14
My application do a repeating request each second - asking the server for a new data, and if there is such - it wakes up the device and run the main application. ( this is by the request from the users, and they does not care about the battery usage, it is mandatory to run each second. It is Highly Critical Operation ) ( any changes to the settings which could help is allowed by the user ) I am curently trying to achieve this by using either AlarmManager or System.Threading.Timer ( tried with both ), but each time I am ending up with the follow issue : The device stop requesting the server at

Lollipop 5.0 Sample License Checker App crashes on Emulator (AVD)

落爺英雄遲暮 提交于 2019-12-06 06:24:55
问题 When running the the sample license check app provided by Google in sdk/extras/google/play_licensing it crashes on the Emulator(AVD) running Lollipop (5.0) (I don't have a phone running 5.0). It works fine on Phone running Kitkat. On 4.4 Kitkat it gives a warning the Implicit intents with startService are not safe: Intent { act=com.android.vending.licensing.ILicensingService } android.content.ContextWrapper.bindService:538 com.google.android.vending.licensing.LicenseChecker.checkAccess:150

How to know a process of an app is 32-bit or 64-bit programmatically in Android lollipop?

北战南征 提交于 2019-12-06 06:15:52
问题 As we all know from Android 5.0.64bit support is there. I have very simple question. Can we check programmatically in what mode any application is running i.e. 32bit or 64bit? For example: I have Facebook app running on my Nexus 9, so can I check using my android app if Facebook app's process is running in 32bit mode or 64bit mode? Thanks in advance! 回答1: Try System.getProperty("os.arch") . I haven't tried it on 64-bit android, but it must return something like 'aarch64' in case of 64 bit

Change the pressed color of action bar item of Lollipop action bar

妖精的绣舞 提交于 2019-12-06 06:10:58
I am using AppCompat and have successfully implemented the new action bar that rolled out with lollipop. The only problem is the pressed background color of the action items. I want to show a different background color for the action item when pressed. Any idea how it can be done? You have a couple of options. But first, some background: The action items in AppCompat use theme attribute ?attr/actionBarItemBackground (see res/values/styles_base.xml) which is set to ?attr/selectableItemBackgroundBorderless (see res/styles/themes_base.xml) by default. This attribute is set to a borderless ripple

SwitchPreference Callback behaviour change in lollipop

我的梦境 提交于 2019-12-06 06:06:51
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 onPreferenceChanged is called. How can I get same behaviour in lollipop? This behaviour is breaking our