android ProgressDialog: setting custom view instead of message - does this work? - android

In ProgressDialog's documentation it says:
"A dialog showing a progress indicator and an optional text message or view. Only a text message or a view can be used at the same time."
I've gotten it working beautifully with a message, but I want to use a custom view instead - a message with a cancel button. But calling setView() on the ProgressDialog seemingly has no effect - it shows the progress bar in the dialog but nothing else. I've tried it with just a TextView with the text "hello", but it doesn't show up.
Does anyone know how to get this feature to work? Is it a real feature?

A possible workaround is to create a custom dialog with a ProgressBar.

Related

Android - How to make a pop up message notification like this?

The pop up message is the Green one. I tried to use snackbar but many says Snackbar cant make custom layout and Toast doesnt have an action. So what should I use to make that green pop up message?
You can create a custom layout for Snackbar. Check-out the solution
https://stackoverflow.com/a/33441214/8122085

How to bypass android dialog outside click

What I want to do is to show the dialog message but make it still possible to click on the items behind. On any click, the dialog would dismiss
Right now I need to click once to dismiss the dialog and a second time to click on a field.
It is something possible ? Or is there an alternative to using Dialogs?
Edit: Solution found by adding Layout Flags to the window.
In kotlin:
dialog.window?.setLayout(ConstraintLayout.LayoutParams.FLAG_NOT_FOCUSABLE, ConstraintLayout.LayoutParams.FLAG_NOT_FOCUSABLE)
By using Dialog you cannot achieve what you are looking for. instead of using Dialog USE FRAGMENT.
The examples are given in official documentation here.
You Can define a full layout in the background of the dialog and set onClick listener to that layout

Alert dialog info button

I am a beginner in android programming and I have noticed, that my tablet Sony Xperia Z4 (Android 6.0) got an alert dialog with 3 buttons: positive, negative and the other one, see in the picture below. This is main menu, not my application.
Alert Dialog info button
My question: is this a custom dialog? I have never met with this type of button in alert dialog.
Thank you.
EDIT:
Duplicate? I don't think so...
AlertDialog.Builder with custom layout and EditText; cannot access view
Why?
User got a problem with accessing an edit text in his dialog.
My question is, if dialog in my tablet is CUSTOM. Nothing else :)
This is not an AlertDialog, instead is just a Dialog with a custom layout, you can do it, you can bind buttons and views to a Dialog and make a custom one like the image you posted. Here is a post that might help you out
How to create a Custom Dialog box in android?

Handling textview hit bottom in alert dialog

I'm setting a message in a simple alert dialog. I need to know if the user has read all the text inside the dialog or not. Is there any way to set a scroll listener or something in an alert dialog?
Create your custom dialog and then set some listener to your custom View. Here's a good example: http://www.mkyong.com/android/android-custom-dialog-example/
and
https://stackoverflow.com/a/10713501

Activity indicator inside an alert

Is it possible to add an activity indicator as a part of an alert? I need this because it is difficult to show alert view in white background. Please suggest ideas.
I was actually searching for progress dialog... loading indicator + message............

Categories

Resources