How can I change default dialog button text color in android 5

Here’s a natural way to do it with styles: If your AppTheme is inherited from Theme.MaterialComponents, then: <style name=”AlertDialogTheme” parent=”ThemeOverlay.MaterialComponents.Dialog.Alert”> <item name=”buttonBarNegativeButtonStyle”>@style/NegativeButtonStyle</item> <item name=”buttonBarPositiveButtonStyle”>@style/PositiveButtonStyle</item> </style> <style name=”NegativeButtonStyle” parent=”Widget.MaterialComponents.Button.TextButton.Dialog”> <item name=”android:textColor”>#f00</item> </style> <style name=”PositiveButtonStyle” parent=”Widget.MaterialComponents.Button.TextButton.Dialog”> <item name=”android:textColor”>#00f</item> </style> If your AppTheme is inherited from Theme.AppCompat: <style name=”AlertDialogTheme” parent=”ThemeOverlay.AppCompat.Dialog.Alert”> <item name=”buttonBarNegativeButtonStyle”>@style/NegativeButtonStyle</item> <item name=”buttonBarPositiveButtonStyle”>@style/PositiveButtonStyle</item> </style> <style name=”NegativeButtonStyle” parent=”Widget.AppCompat.Button.ButtonBar.AlertDialog”> … Read more

RecyclerView header and footer

in your adapter add this class: private class VIEW_TYPES { public static final int Header = 1; public static final int Normal = 2; public static final int Footer = 3; } then Override the following method like this: @Override public int getItemViewType(int position) { if(items.get(position).isHeader) return VIEW_TYPES.Header; else if(items.get(position).isFooter) return VIEW_TYPES.Footer; else return VIEW_TYPES.Normal; … Read more

Material effect on button with background color

When you use android:background, you are replacing much of the styling and look and feel of a button with a blank color. Update: As of the version 23.0.0 release of AppCompat, there is a new Widget.AppCompat.Button.Colored style which uses your theme’s colorButtonNormal for the disabled color and colorAccent for the enabled color. This allows you … Read more

How can incoming calls be answered programmatically in Android 5.0 (Lollipop)?

Update with Android 8.0 Oreo Even though the question was originally asked for Android L support, people still seem to be hitting this question and answer, so it is worth describing the improvements introduced in Android 8.0 Oreo. The backward compatible methods are still described below. What changed? Starting with Android 8.0 Oreo, the PHONE … Read more

Manifest merger failed : uses-sdk:minSdkVersion 14

Note: This has been updated to reflect the release of API 21, Lollipop. Be sure to download the latest SDK. In one of my modules I had the following in build.gradle: dependencies { compile ‘com.android.support:support-v4:+’ } Changing this to dependencies { // do not use dynamic updating. compile ‘com.android.support:support-v4:21.0.0’ } fixed the issue. Make sure … Read more

Lollipop : draw behind statusBar with its color set to transparent

Method #1: To achieve a completely transparent status bar, you have to use statusBarColor, which is only available on API 21 and above. windowTranslucentStatus is available on API 19 and above, but it adds a tinted background for the status bar. However, setting windowTranslucentStatus does achieve one thing that changing statusBarColor to transparent does not: … Read more

Android 5.0 – Add header/footer to a RecyclerView

I had to add a footer to my RecyclerView and here I’m sharing my code snippet as I thought it might be useful. Please check the comments inside the code for better understanding of the overall flow. import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.ArrayList; public class RecyclerViewWithFooterAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { … Read more

DexIndexOverflowException issue after updating to latest appcompat and support library

This message sounds like your project is too large. You have too many methods. There can only be 65536 methods for dex. Since the gradle plugin 0.14.0 and the Build Tools 21.1.0 you can use the multidex support. Just add these lines in the build.gradle: android { defaultConfig { … // Enabling multidex support. multiDexEnabled … Read more

tech