android-5.0-lollipop

Detect which app has been launched in android

China☆狼群 提交于 2019-12-24 00:49:16
问题 How to detect which app has been launched by user in my app i.e my application should get notified when Whatsapp is launched by user even if my app is not running in foreground or background. hike messenger has achieved same functionality with accessibility service. How can I solve this problem ? Thanks in advance!! 回答1: Depending on the Android version running your application, you will have to use different methods. On Pre-Lollipop devices, it is pretty straight-forward: String[] result =

Send user to data usage settings window

六月ゝ 毕业季﹏ 提交于 2019-12-24 00:11:55
问题 Till android 5, user could turn on cellular data from the roaming settings window. So Settings.ACTION_DATA_ROAMING_SETTINGS is used to send user there. In lollipop though, you no longer can do that and the option to turn on mobile data is under data usage window. Question is, how can send user to that window as Settings don't seem to have anything to help me. Thanks 回答1: I don't think there is currently a way to show programmatically the Settings - Data Usage screen on Lollipop 5.0. The class

Android L, exception using joda.time Library

て烟熏妆下的殇ゞ 提交于 2019-12-23 16:48:16
问题 An app used to work in all devices including (nexus 5 and nexus 7). Running the same app on Android L preview, the app crash. I have been debugging and the exception was founded calling DateTime Constructor. public static String[] getAge(Context context, Date date) { DateTime time = new DateTime(date); DateTime nowTime = new DateTime(new Date()); } Log: java.lang.SecurityException: Incorrect signature at org.apache.harmony.security.utils.JarUtils.verifySignature(JarUtils.java:223) at java

Button's background drawable (shape) won't show up unless app API is 20+ (Android L)

落花浮王杯 提交于 2019-12-23 13:28:08
问题 In my Android app, I'm trying to set a simple ring shape as background drawable for my Buttons. But as much as I try, the XML preview ignores the background drawable unless the API level is set to 20 (Android L) What's going on? I'm sure people used to set shapes for buttons before L. Code for my XML shape for button_ring.xml located in /drawables folder <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" > <solid

Fixed text size in WebView Android (Lollipop)

陌路散爱 提交于 2019-12-23 11:59:17
问题 I have this simple code in WebView <tr><td valign='top' width='30%'><span style='font-size:11px !important;'> @label</span></td><td valign='top' width='2%'><span style='font-size:11px !important;'>:</span></td><td ><span style='font-size:11px !important;word-break:keep-all;'> @val</span></td></tr> How to have fixed font size of 11px? If I increase/decrease the system font-size in display settings, the above code works perfectly fine in pre-lollipop version. But in Lollipop the font size is

Android L is not able to draw dotted line as drawable background

痴心易碎 提交于 2019-12-23 10:59:09
问题 Android L is not able to draw dotted line as drawable background as below: <?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="line" > <stroke android:dashGap="1dp" android:dashWidth="1dp" android:color="#999999" /> <size android:height="1dp" /> </shape> </item> </selector> I am also using layerType='software' in xml. Kindly help. 回答1: 1.The view must be at least 2dp in height (or wrap_content ), in order

Android L battery historian.par tool missing

让人想犯罪 __ 提交于 2019-12-23 10:49:24
问题 Since Google made the updated SDK for Android L available on their website. I have been trying to test the new battery historian feature. The Google API overview website claims that the tool is available under sdk/tools. Unfortunately even after ensuring that I have updated the SDK completely I am unable to find the tool anywhere. Does anyone know how I can access this tool? 回答1: It's not missing it's available at: https://github.com/google/battery-historian note: it currently requires the

About RecyclerView.ViewHolder and RecyclerView.Adapter

家住魔仙堡 提交于 2019-12-23 09:39:06
问题 The RecyclerView.ViewHolder class has a field that is public final View itemView . It says that the onBindViewHolder method should update the contents of the itemView to reflect the item at the given position . Doesn’t the final modifier indicate that the value of this field cannot change ? The code below is from the textbook : public class ViewHolder extends RecyclerView.ViewHolder { ... @Override public int getItemCount() { ... } @Override public ViewHolder onCreateViewHolder(ViewGroup

Spinner malfunctioning on Lollipop

纵饮孤独 提交于 2019-12-23 08:04:22
问题 My Android Project Build Target is 5.1.1 API 22 This app seems to work for every OS version except Lollipop. Lollipop restructures the height of some activities (negating the scrollable layout) as well as disrupts the spinners. Clicking a specific position on a spinner will input a different position in the app. I'm not sure why and I don't know how to fix this. In some cases, even if you click a button on the spinner, it registers the bottom most visible button on the spinner. For some

Toolbar - findViewbyID returning null

萝らか妹 提交于 2019-12-23 07:59:17
问题 Why am I unable to find my Toolbar in my layout? setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar); getSupportActionBar().setHomeButtonEnabled(true); } After that, toolbar is still null. activity_man.xml: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent