android-5.0-lollipop

Now Playing Card

帅比萌擦擦* 提交于 2020-01-05 20:31:14
问题 I need help about displaying the Now Playing Card in the Recommendations row. I read the post about it in the Android developers site, but that did not help me much. I have a service that streams the MP3 data without problems. I added the following code, but there's no Now Playing Card... @Override public void onCreate() { Log.i(TAG, "onCreate called"); mSession = new MediaSession(this, "MusicService"); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(MediaSession.FLAG

Constant states do not match in developer preview android L

妖精的绣舞 提交于 2020-01-05 05:26:14
问题 I am trying to do something in an if-statement, this works in every version of android (16 or higher because of the getDrawable) except Android L (tested on latest). The code is the following: if (item.getIcon().getConstantState().equals(getResources().getDrawable(R.drawable.add_to_fav_normal).getConstantState()) Any help/hints or explanation would be appreciated! 回答1: Use item.getContext().getDrawable(int) or the equivalent ContextCompat method. Starting in API 21, all framework widgets that

Name of the layout or how it's done?

[亡魂溺海] 提交于 2020-01-05 04:34:12
问题 In short I want a preview similar to Google Plays, where you can slide up and the top image/video preview fades back and the rest of the view is moved up. I've got a view that I want to be hiden like the video in this example, the action bar can remain stationary at all times, but I need the bottom part to be dragable. I can't seem to find out which layout that is, or how it is done, all I managed to find were unrelated such as ViewPager. My current min sdk version is 18, the compile version

Can you uniquely identify a BLE MAC address in Android 5.0?

风流意气都作罢 提交于 2020-01-05 04:34:07
问题 In Android 5.0, BLE doesn't use static MAC addresses anymore, but the MACs change after intervals, using a method called IRK and public key cryptography. Is it possible to uniquely identify an Android phone in a way that can not be spoofed by the user of that phone, or has that become completely impossible now unless the other side co-operates? 回答1: No, it is not possible. That's the whole idea of using IRKs: only bonded devices can identify it after the address changes. For those who do not

How to determine/get correct S Voice packet in Android

陌路散爱 提交于 2020-01-05 04:03:07
问题 I am using Android to turn on my S Voice application in Android. As previous work, I will use the follows code to turn on it String SVOICE_PACKAGE_NAME = "com.vlingo.midas"; String SVOICE_LISTEN_ACTION = "com.sec.action.SVOICE"; Intent intent = new Intent(); intent.setPackage(SVOICE_PACKAGE_NAME); intent.setAction(SVOICE_LISTEN_ACTION); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); try { getApplication().startActivity(intent); } catch (final

Dumping AppCompat for API 21

和自甴很熟 提交于 2020-01-03 18:49:29
问题 So I'm creating an app that is Lollipop 5.0 API 21 and up with zero interest in supporting older devices. Do I still need the appcompat library when using Material Design like UI elements & layouting (sidebar aka nav bar, ink, etc) ? When stripping it down I often encounter crashes when trying to move away from the AppCompat stuff. Changing activity types from the AppCompat one to the Normal one, I end up with problems regarding dependencies on layout types like the coordinator layout that

OnClick event on TextView stops RippleEffect on CardView

天涯浪子 提交于 2020-01-03 14:05:24
问题 I have a TextView inside a CardView. When enabling the ripple effect for Lollipop on the CardView by adding a OnClick event and adding the property: android:foreground="?android:attr/selectableItemBackground" It works fine. But after adding a OnClick event to the TextView, the ripple effect still shows up when I click outside of the TextView, but it won't show when clicking on the TextView area. Is there away to show the ripple even when I click the TextView? Here is xml: <RelativeLayout

Android Random Number llegalArgumentException: n <= 0: 0

纵然是瞬间 提交于 2020-01-03 13:30:08
问题 I am trying to generate Random Number from 0 to 43 range. But at Some Devices (OnePlus Android 5.0.2 and Nexus 5.1) it is throwing java.lang.IllegalArgumentException: n <= 0: 0. I am not able to catch that exception Below is my Code to generate the random Number. Random rand = new Random(); int maximum = mListofStrings.getMyString().size() - 1; Log.e("Max",""+maximum); Mint.logEvent("Maximum", MintLogLevel.Error); int randomNum; try{ // randomNum = rand.nextInt(43); randomNum = rand.nextInt

Android MediaCodec API not working in Child Thread

試著忘記壹切 提交于 2020-01-02 19:32:10
问题 In Android, I tried using MediaCodec api (MediaCodecList.getCodecCount()) in Main Thread seems working fine with no issues. But the same api when i used inside its child thread , ends up with application crash. The crash log was stated below: A/libc(18571): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe0 in tid 18600 The above scenario was tested with Andriod 5.0.2 mobile device. Why such behaviour and any idea to resolve this ? 来源: https://stackoverflow.com/questions/32884208/android

Android Studio Action Bar Color not Changing

你离开我真会死。 提交于 2020-01-02 06:47:09
问题 in styles.xml running Android 5.0 lollipop <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="android:colorPrimary">@color/primary</item> <item name="android:colorPrimaryDark">@color/primary_dark</item> <item name="android:colorAccent">@color/accent</item> <item name="android:statusBarColor">@color/primary</item> <item name="android:colorAccent">@color/accent</item> <item name=