android-5.0-lollipop

How to make the Contextual ActionMode Bar overlay the appcompat-v7 Toolbar but not the navigation drawer?

我的梦境 提交于 2019-12-03 18:43:58
问题 I have an activity with an app bar and a navigation drawer. The app bar is implemented using the new Toolbar class from appcompat-v7 library version 21.+, and the navigation drawer is displayed in front of it. The activity contains a list view with items which can be selected, so I am showing a contextual action bar (CAB). It is started by calling: ActionBarActivity.startSupportActionMode(android.support.v7.view.ActionMode.Callback callback) By default, the CAB is inserted above the Toolbar

Error inflating class RecyclerView

萝らか妹 提交于 2019-12-03 18:00:38
问题 So my code simply makes a list of CardViews using RecyclerView. Upon running my code i kept getting a weird error claiming there was an error in my xml. After tinkering for a while i found out that in my layout file if i change <RecyclerView> to <android.support.v7.widget.RecyclerView> everything would work just fine. Why is this happening? My activity. import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import

ConnectivityManager.EXTRA_NO_CONNECTIVITY is always false on Android Lollipop

自古美人都是妖i 提交于 2019-12-03 17:47:43
问题 I am using this piece of code to detect Internet connection state changes. It works fine on Android<5.0, but on API 21 this: intent.getExtras().getBoolean(ConnectivityManager.EXTRA_NO_CONNECTIVITY) is always false. How to make this code to work on Android 5.0? My BroadcastReceiver: public class NetworkStateReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent intent) { if(intent.getExtras()!=null) { final ConnectivityManager

How to be notified when screen pinning is turned off in Android 5.0 Lollipop?

独自空忆成欢 提交于 2019-12-03 17:34:14
I have an app that runs in the background and starts an activity when a certain event occurs on the phone. I'm finding with Android 5.0 that when the user has screen pinning turned on with another app, the startActivity(intent) call is ignored completely. My app doesn't know that the activity didn't start, so the user then won't have another chance to see the activity until they manually reopen my app. Is there any sort of event I can register for to be notified when screen pinning is turned off, so I can reattempt to start my activity? Here is method in ActivityManager class which tells

Data transfer between application outside profile and inside profile in Android Lollipop

断了今生、忘了曾经 提交于 2019-12-03 16:48:42
Question related to Android for Work . My application was a device Admin privileged app and now I have modified the code which creates a managed work profile and sets itself as the profile owner. The question is, if I upgrade my application, it becomes a profile owner from device admin. Now there will be two copies of my application, one outside the profile and one inside (badged version). Is there a way if I need to transfer some data from the personal space app to the work profile app (badged version)? Lorenz Riedler The DevicePolicyManager class implements a the addCrossProfileIntentFilter

Handling media buttons in Android 5.0 Lollipop

余生长醉 提交于 2019-12-03 16:48:28
问题 Pre API 21 I was using a call like audioManager.registerMediaButtonEventReceiver(receiver); to handle media button events when a user pressed a button on his headset. As of API 21, it seems that MediaSession should be used. However, I'm not getting any response whatsoever. final MediaSession session = new MediaSession(context, "TAG"); session.setCallback(new Callback() { @Override public boolean onMediaButtonEvent(final Intent mediaButtonIntent) { Log.i("TAG", "GOT EVENT"); return super

Parent activity becomes invisible on exit transition

▼魔方 西西 提交于 2019-12-03 16:47:23
I'm using API Level 21, testing on a Nexus 6. I have two activities: master + detail, each view has a fragment. When I select an item in the master list it transitions to the detail view. I have enabled view transitions in both master and detail, like this: getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); Transition ts = new Slide(Gravity.RIGHT); ts.setDuration(2500); getWindow().setEnterTransition(ts); getWindow().setExitTransition(ts); getWindow().setAllowEnterTransitionOverlap(true); getWindow().setAllowReturnTransitionOverlap(true); The transition animations works as

List view set a custom ripple selector

断了今生、忘了曾经 提交于 2019-12-03 16:37:07
问题 I'm trying to use a list view control on Lollipop under the following conditions: The theme type is the default Theme.Material (dark theme). The list view is contained inside of larger layout which has a white background. The list view should have a list selector that appears with the white background. NOTE: I am forced to use a custom list selector color because if I use a white background, the dark material themed selector uses the theme's colorControlHighlight color for the ripple, which

Android Toolbar style

淺唱寂寞╮ 提交于 2019-12-03 16:23:26
问题 I've added a Toolbar to my Lollipop project. However, I'm having trouble styling the Toolbar . My title in the Toolbar appears to have a bold font, but I'd like it to be italic. Any idea how to achieve this? I've tried playing around with the actionbar-style , no luck. I've set a style on the Toolbar with app:theme="@style/toolbar" and my @style/toolbar (parent ThemeOverlay.AppCompat.ActionBar ) is where I'm playing around with no good results. 回答1: You can add TextView inside Toolbar, for

Android Lollipop - changed behavior of SQLite

风格不统一 提交于 2019-12-03 16:12:53
问题 When testing one of my apps for Android 5.0 compatibility I found that one two of my SQL queries doesn't don't work as expected anymore on Lollipop. Both of my problems led to significantly different results on Lollipop compared to older Android versions. Below, I will describe those problems and their solutions more deeply in case you have similar issues. My main question is quite simple: Are those non-backwards compatible changes somewhere documented? Problem number one: MATCH It seems that