CardView goes on top of FrameLayout, but declared first

In case someone gets here and the solution for setting elevation doesn’t work for them (like in my case, where I needed to draw an image above the CardView and having a shadow on it was not acceptable), you can solve the issue by wrapping the CardView inside another FrameLayout. In the example provided, it … Read more

Send request over Mobile data when WIFI is ON.(Android L)

Well finally found solution for this. Trick was to use capability as NET_CAPABILITY_INTERNET. Which is same as startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, FEATURE_ENABLE_HIPRI); See the Firmware design here builder.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET); builder.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR); After this I am able to get onAvailable callback from system and later I set my process default network as mobile data. Hence all the request goes over mobile … Read more

Setting header color of app in overview (recent apps) screen

You can change this via ActivityManager.TaskDescription: https://developer.android.com/reference/android/app/ActivityManager.TaskDescription.html From an Activity context, call: TaskDescription taskDescription = new TaskDescription(label, icon, colorPrimary); ((Activity)this).setTaskDescription(taskDescription);

application content goes behind the navigation bar in android L

Here is the solution. Most of the layouts get solved by adding these properties in values-v21 style.xml <item name=”android:windowTranslucentStatus”>true</item> <item name=”android:windowTranslucentNavigation”>true</item> <item name=”android:fitsSystemWindows”>true</item> for others, I have calculated the hight of navigation bar and add margin to my view . public static int getSoftButtonsBarSizePort(Activity activity) { // getRealMetrics is only available with API 17 and … Read more

Android XML: android:elevation vs. app:elevation

Hope I can help, Let’s talk with an example: <android.support.design.widget.FloatingActionButton android:layout_height=”wrap_content” android:layout_width=”wrap_content” … android:elevation=”@dimen/elevation_medium” /> The android:elevationattribute will work from the API level 21 and upper. <android.support.design.widget.FloatingActionButton android:layout_height=”wrap_content” android:layout_width=”wrap_content” … app:elevation=”@dimen/elevation_medium” /> In this case the app:elevation attribute belongs to the FloatingActionButton styleable, inside de Android Design Support Library which will work from version 4 … Read more

Lollipop RippleDrawable vs Selector for Pre-Lollipop

1) Yes. See the documentation for RippleDrawable for more details on how layers are composited, but basically you want: <?xml version=”1.0″ encoding=”utf-8″?> <ripple xmlns:android=”http://schemas.android.com/apk/res/android” android:color=”?android:attr/colorControlHighlight”> <item android:drawable=”https://stackoverflow.com/questions/24607339/@drawable/yourninepatch” /> </ripple> Or to also handle the disabled state in a clean way, you might want: <?xml version=”1.0″ encoding=”utf-8″?> <ripple xmlns:android=”http://schemas.android.com/apk/res/android” android:color=”?android:attr/colorControlHighlight”> <item> <selector> <item android:state_enabled=”false”> <nine-patch android:src=”https://stackoverflow.com/questions/24607339/@drawable/yourninepatch” … Read more

How can I Animate the color change of the statusbar and toolbar (like the new Calendar app does)

I don’t know if this is the exact way the Calendar app does it, but it’s close enough for me. Caveats The method uses the ViewAnimationUtils.createCircularReveal method introduced in Lollipop. It requires knowing the height of the status bar and your toolbar actionbar. You can still use ?attr/actionBarSize for your actionbar and get both dynamically, … Read more

Chipsets/Devices supporting Android 5 BLE peripheral mode

The Android 5.0.X will only allow you to use the new API for BLE. This new API comes with a new feature, which you mentioned in your question: The possibility of advertising, from your own Android device, using it in Peripheral mode. However, the disadvantaged of this new feature is that it is hardware dependent. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)