android-5.0-lollipop

Cannot stop AudioTrack on Android 5

时光怂恿深爱的人放手 提交于 2019-12-22 00:33:12
问题 I cannot stop playback of an AudioTrack on a Nexus 4 running Android 5.0.1. Am I doing something wrong? The code is very simple (it's actually just a test app) and it works perfectly on devices running 2.3.6 and 4.4. Here's the relevant portion: mPlugReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if(Intent.ACTION_HEADSET_PLUG.equals(intent.getAction())) { boolean plugged = intent.getIntExtra("state", 0) == 1; if(plugged) { log.debug(

How to detect if your android app is in the foreground (API 21)

只谈情不闲聊 提交于 2019-12-21 22:11:23
问题 when receiving a GCM message, the behaviour of my app depends on if it is in the foreground or not. Prior to API 21 I used the following: Boolean onForeground = this.getPackageName().equalsIgnoreCase( ((ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE)) .getRunningTasks(1).get(0).topActivity.getPackageName() ); Now getRunningTasks() is deprecated and behaving differently on API 21, what would be the best way on API 21 to detect if my app is in the foreground? Google recommends

Android onChange event not triggered in contentObserver for chrome history on android 5 (Lollipop)

一笑奈何 提交于 2019-12-21 19:57:11
问题 I've noticed that my contentObservers for chrome history and bookmarks do not trigger anymore on android lolipop. The code works perfectly on older versions of android (regardless of the chrome version) but on Lollipop it is not working anymore. I've filed a bug on chromium and this is confirmed by others in the comments. https://code.google.com/p/chromium/issues/detail?q=obogzch%40gmail.com&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id

Android onChange event not triggered in contentObserver for chrome history on android 5 (Lollipop)

老子叫甜甜 提交于 2019-12-21 19:55:31
问题 I've noticed that my contentObservers for chrome history and bookmarks do not trigger anymore on android lolipop. The code works perfectly on older versions of android (regardless of the chrome version) but on Lollipop it is not working anymore. I've filed a bug on chromium and this is confirmed by others in the comments. https://code.google.com/p/chromium/issues/detail?q=obogzch%40gmail.com&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id

UI distortion issue on Android 5.0 Lollipop

独自空忆成欢 提交于 2019-12-21 19:17:13
问题 On LG Nexus 4 (android 5.0.1) we are facing a strange issue, UI got distorted after exploring the app for some time. Screen shot is at below link. Any help will be appreciable. 回答1: I also had this problem recently. These solutions helped me: Android SystemUI glitches in Lollipop and Android Lollipop Activity Screen corrupted For me the problem were some WebViews that were distorting my layouts. 来源: https://stackoverflow.com/questions/27617847/ui-distortion-issue-on-android-5-0-lollipop

Get WiFi captive portal info

浪尽此生 提交于 2019-12-21 18:34:19
问题 Is there a way to access Android's broadcast that the WiFi connection is currently a captive portal (requires web login)? Android seems to do have this built in. If not a broadcast receiver, is there a way to check for the result of the captive portal check? I believe it's using this class, which is hidden from the API: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.L_preview/android/net/CaptivePortalTracker.java Prior to 4.2, it was probably using:

Android Support Library v17

旧街凉风 提交于 2019-12-21 13:48:34
问题 I just downloaded Eclipse 4.4 Luna and installed the latest ADT 20 on it. Now, new templates for new Android Project are included. One of them is "Android TV Activity". The existing code uses Android Support Library v17!! import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.support.v17.leanback.widget.ImageCardView; import android.support.v17.leanback.widget.Presenter; import

UsageStatsManager returning data from just last day/week/month/year?

你离开我真会死。 提交于 2019-12-21 12:36:11
问题 I'm trying to query UsageStats from UsageStatsManager . I've build a DateUtils class that provide me with methods to get the start and end time of each day/month/year (week is coming), like this: public static Calendar getCal(int year, int month, int day) { Calendar cal = Calendar.getInstance(); cal.set(year, month, day, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); return cal; } public static long getDayStart(int year, int month, int day) { return getCal(year, month, day).getTimeInMillis(); }

Android L reveal Effect is not working

本秂侑毒 提交于 2019-12-21 09:25:21
问题 I tried to implement createCircularReveal() in FloatingButton . But the animation is too fast. How to increase the duration of the Animation. I tried setDuration(milli-seconds) , But its not working. I follow developer.android.com, Defining Custom Animations Here my code: int cx = (fabBtn.getLeft() + fabBtn.getRight()) / 2; int cy = (fabBtn.getTop() + fabBtn.getBottom()) / 2; int finalRadius = Math.max(fabBtn.getWidth(), fabBtn.getHeight()); Animator anim = ViewAnimationUtils

What's happened to Monospace in Android Lollipop?

偶尔善良 提交于 2019-12-21 08:17:13
问题 I have a style to use "monospace" in my Android App: <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar" > <!-- Customize your theme here. --> <item name="android:windowNoTitle">true</item> <item name="android:typeface">monospace</item> <item name="android:textColorPrimary">@android:color/white</item> <item name="android