android-5.0-lollipop

Error: cannot find symbol variable LOLLIPOP

元气小坏坏 提交于 2019-12-12 19:00:31
问题 I have seen many examples in different android libraries about detecting if device is LOLLIPOP supported or not. But when I use it in my app, it is throwing the following error: Error:(20, 60) error: cannot find symbol variable LOLLIPOP For example my source code is: static boolean isLollipop() { return Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP || Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1; } I am using the latest version of Android Studio with all packages updated

Change status / notification bar color on api below 21 android?

青春壹個敷衍的年華 提交于 2019-12-12 17:14:17
问题 I have seen in some apps the status bar color could be changed and matched to as what is being done in api level 21. I searched and found this solution Source <style name="Theme.MyTheme" parent="Theme.AppCompat.Light"> <!-- Set AppCompat’s color theming attrs --> <item name="colorPrimary">@color/my_awesome_red</item> <item name="colorPrimaryDark">@color/my_awesome_darker_red</item> <!-- Other attributes --> </style> But it is not working This is my style code <style name="ToolbarTheme" parent

MediaSession does not show background on lock screen

扶醉桌前 提交于 2019-12-12 16:26:24
问题 I am using MediaSession on Lollipop to control playback. It appears to work because my Android Wear device allows me to control playback, however the phone lock screen isn't showing the image from METADATA_KEY_ALBUM_ART_URI and the background on Android Wear isn't showing either. I am using my own custom notification (not media style notification). Here is my MediaSession code. if (mediaSession == null) { mediaSession = new MediaSession(this, TAG); mediaSession.setCallback(new

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation after adding AppCompat to stable application

99封情书 提交于 2019-12-12 15:51:27
问题 I have my stable app that's been working for months now, and after adding appcompat_v7 to support Material theme everything went to crap. I just changed my Activities to ActionBarActivity and the theme to Theme.AppCompat Once every other run I get java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation inside a random library or in arbitrary points of execution not related to views. It requires a clean build and uninstall to get it to work again.

How to implement more than 2 level navigation in com.android.support:leanback-v17

若如初见. 提交于 2019-12-12 15:11:27
问题 In regular android application I can use navigation drawer for navigate between top level views (sections of app) What should be used in tv apps? I see only possibility for two level of content organizing Categories -> Movies But in our app we have several sections (Live channels, On demand Movies, Recorded shows etc) with categories in most of them. Is it possible using standard android.support.v17.leanback.app.BrowseFragment and android.support.v17.leanback.app.DetailsFragment? 回答1: In

Why can't I create a restricted profile when an owner device app is set?

寵の児 提交于 2019-12-12 13:53:28
问题 I recently noticed that when a Device Owner application is set, it's not possible to create a restricted profile. First case : When my device owner app is not set . From Settings>Users : I can "Add user or Profile" , and then choose between a User or a Restricted Profile . Second case : When my device owner app is set . From Settings>Users : I can only "Add user" , and then i get the confirmation to create a new user. In this second case, it's not possible to create a restricted profile. I'd

SeekBar setProgress trashes secondary progress

女生的网名这么多〃 提交于 2019-12-12 12:15:50
问题 I have primary and secondary progress growing in the same time, secondary progress grows faster than primary. Everytime I update the primary progress, the secondary one is lost (like it would be zero or less than primary). This produces a nasty flickering. The only workaround I found is set the secondary to itself after setting the primary. I added "+1" as SeekBar has a check and doesn't redraw if I set the same value. mSeekBar.setProgress(newPosition); mSeekBar.setSecondaryProgress(mSeekBar

Intergrate camera without deprecated methods and backwards support

安稳与你 提交于 2019-12-12 12:15:08
问题 I want to build an application where the front camera of the device is used to project the current image to a SurfaceView . All the tutorials I found so far implement this by using a Camera object from the android.hardware package. This method, however, seems to be deprecated. When trying the 'new' preferred way to implement this feature following the Android documentation, I get the warning it can only be used with API level 21, which is pretty useless. So I would like to know the currently

Elevation effect for ImageButton on Pre-Lollipop devices

强颜欢笑 提交于 2019-12-12 12:11:52
问题 I am trying the apply elevation effect for ImageButton. It works well on my Nexus tablet running Android 5.0 but elevation does not work on Pre-Lollipop devices. Tried ViewCompat.setElevation(view, evaluationValue) but nothing changed. I saw some applications like Swarm or Gmail apps use elevation effect for their FAB (Floating Action Button) on Pre-Lollipop devices. Do you have an idea how they use elevation? 回答1: You cannot use elevation pre 5.0, you need to provide an image with a "shadow"

Android lollipop contact color

江枫思渺然 提交于 2019-12-12 10:17:10
问题 How do select color of contact badge. What algorithm using? 回答1: It does not save. It uses the hashcode of the Contact name string to determine the color. Example: String name = "Harish"; int colors[] = new int[] { Color.RED, Color.GREEN, Color.BLUE}; int chosenColor = colors[Math.abs(name.hashCode()) % colors.length]; I learnt from this answer 回答2: You can try a Color generator like this.. public class ColorGenerator { public static ColorGenerator DEFAULT; public static ColorGenerator