What does it mean that a Listener can be replaced with lambda?

It means that you can shorten up your code. An example of onClickListener() without lambda: mButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // do something here } }); can be rewritten with lambda: mButton.setOnClickListener((View v) -> { // do something here }); It’s the same code. This is useful when using a lot … Read more

Change the background color of a pop-up dialog

To expand on @DaneWhite’s answer, you don’t have to rely on the built-in themes. You can easily supply your own style: <style name=”MyDialogTheme” parent=”Theme.AppCompat.Light.Dialog.Alert”> <item name=”android:background”>@color/myColor</item> </style> and then apply it in the Builder constructor: Java: AlertDialog alertDialog = new AlertDialog.Builder(getContext(), R.style.MyDialogTheme) … .create(); Kotlin: var alertDialog = AlertDialog.Builder(context, R.style.MyDialogTheme) … .create() This should work … Read more

DialogFragment advantages over AlertDialog [duplicate]

This is easy. DialogFragment is a fragment. So what can a fragment provide you while other objects can’t? It’s the lifecycle callbacks. So with DialogFragment, it can be very powerful and makes your code much cleaner. Have you ever seen window leaks if you didn’t close a dialog when its Activity was getting destroyed? So … Read more

android activity has leaked window com.android.internal.policy.impl.phonewindow$decorview Issue

Thank you Guys to give me many suggestions. Finally I got a solution. That is i have started the NetErrorPage intent two times. One time, i have checked the net connection availability and started the intent in page started event. second time, if the page has error, then i have started the intent in OnReceivedError … Read more

MaterialComponents theme alert dialog buttons

I figured out what was causing this problem. I need to use different AlertDialog class: androidx.appcompat.app.AlertDialog When I switched to this everything started working as expected. Here’s where I found the solution: https://github.com/material-components/material-components-android/issues/162

How can I change the color of AlertDialog title and the color of the line under it

Unfortunately, this is not a particularly simple task to accomplish. In my answer here, I detail how to adjust the color of a ListSeparator by just checking out the parent style used by Android, creating a new image, and creating a new style based on the original. Unfortunately, unlike with the ListSeparator‘s style, AlertDialog themes … Read more

How to implement a custom AlertDialog View

You can create your view directly from the Layout Inflater, you only need to use the name of your layout XML file and the ID of the layout in file. Your XML file should have an ID like this: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/dialog_layout_root” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:padding=”10dp” /> And then you can set … Read more

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