android-5.0-lollipop

How to fix IncompatibleClassChangeError during Android Jackson Parsing using annotations in Android Lollipop?

╄→гoц情女王★ 提交于 2020-06-24 08:05:38
问题 In our android app, we use Jackson Annotations in our models: @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "templateType", visible = true, defaultImpl = Default.class) @JsonSubTypes({ @Type(value = Subclass1.class, name = "tType1") We parse the json response using object mapper where klass is the class of the object file which we wish to parse to: getObjectMapper().readValue(json, klass); On rare scenarios on Android Lollipop devices, we get java

Android Camera2 front camera

﹥>﹥吖頭↗ 提交于 2020-05-12 11:13:46
问题 I recently noticed that the Camera API is deprecated and I found the new API called Camera2. I have read the documentation but I don't really understand it. So my question is: how do I preview the front camera with the new camera api? Just a preview, not recording. I want to use this new API because in the future I'm guessing the current Camera API will be replaced and stop working. So I want to be prepared and just sit and watch while everyone panics. XD 回答1: First of all, find out the id of

Remove the white screen a Slide window transition creates when it starts

爱⌒轻易说出口 提交于 2020-05-07 11:58:27
问题 I am using an activity with a black background. That same activity has a toolbar and a DrawerLayout as well. This white screen makes the look inconsistent. It can become more apparent when there is a very slow Slide transition when opening an activity. Is there any way to remove this? Code that sets the enter transition on the second activity: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = activity.getWindow(); Slide slide = new Slide(); slide.setSlideEdge

Dismissing MediaStyle notifications

只愿长相守 提交于 2020-02-21 05:51:54
问题 New Android MediaStyle notifications in Lollipop don't have a dismiss button. Looks like there is already a bug for it on Google Code. Does anyone know what's a good workaround for this issue until the bug is resolved? Should we just delay switching to MediaStyle? Or use one of the actions as the dismiss button? 回答1: One mechanism which appears to work quite well is make the notification ongoing while music is playing and make it not ongoing (allowing it to be swipe dismissed) when the music

Toolbar title with custom view

偶尔善良 提交于 2020-02-20 08:09:04
问题 I am attempting to show both a title, using setTitle and a custom view in my toolbar. I am not treating it as an actionbar, instead as nothing more than a view. I am adding both the titles and custom view in Java toolbar = (Toolbar) view.findViewById(R.id.toolbar); if (title != null) { toolbar.setTitle(title); toolbar.setTitleTextColor(getResources().getColor(android.R.color.white)); } if (subtitle != null) { toolbar.setSubtitle(subtitle); toolbar.setSubtitleTextColor(getResources().getColor

How can I use AccessibilityService.getWindows() to obtain a traversable AccessibilityNodeInfo?

大兔子大兔子 提交于 2020-02-13 13:02:09
问题 I am writing an AccessibilityService for Android and, up to API level 20, I have been using the AccessibilityEvent.getSource() method to obtain a traversable AccessibilityNodeInfo when onAccessibilityEvent(AccessibilityEvent event) is triggered. Although the resulting AccessibilityNodeInfo does not always reflect the content of the screen, it is still possible to work with it. Starting on API level 21, the new AccessibilityService.getWindows() is supposed to be not only able to better

How can I use AccessibilityService.getWindows() to obtain a traversable AccessibilityNodeInfo?

半世苍凉 提交于 2020-02-13 13:01:06
问题 I am writing an AccessibilityService for Android and, up to API level 20, I have been using the AccessibilityEvent.getSource() method to obtain a traversable AccessibilityNodeInfo when onAccessibilityEvent(AccessibilityEvent event) is triggered. Although the resulting AccessibilityNodeInfo does not always reflect the content of the screen, it is still possible to work with it. Starting on API level 21, the new AccessibilityService.getWindows() is supposed to be not only able to better

MATCH with selectArgs looking like *queryTerm* stopped working on Android 5.0+

送分小仙女□ 提交于 2020-02-07 07:23:25
问题 This is addendum to my question SQLiteDatabase Cursor empty only on Android 5.0+ devices. That one will be closed as I was not sure what is causing the bug - thought it was a cursor note being properly filled. Now I have discovered what is causing empty cursor. Up to Android 5.0, search suggestions work by querying the database with the query: SELECT rowid AS _id, suggest_text_1, suggest_text_2, rowid AS suggest_intent_data_id FROM fts WHERE (fts MATCH ?) //for example '*e*' As of Android 5.0

What does TranslationZ actually do in Android?

这一生的挚爱 提交于 2020-02-01 17:40:59
问题 Hi I am developing android application in which I am trying to implement new material design features. I tried to apply both elevation property and TranslationZ property but it is not working. <Button android:id="@+id/button1" style="@style/ButtonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:text="Name" /> <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape=

android:Theme.Material.Light requires API level 21 (current min is 8)

旧城冷巷雨未停 提交于 2020-01-30 14:29:29
问题 I want to use Material Theme in my application which has minimum sdk version of 8. As per docs - "The material theme is only available in Android 5.0 (API level 21) and above. The v7 Support Libraries provide themes with material design styles for some widgets and support for customizing the color palette." Does it mean I can use it if I add v7 Support Libarary in my project? Because after adding this library I got the following error: android:Theme.Material.Light requires API level 21