Alert in android - android

I am having a bitmap image. Can i show it in a Alert Dialog in android?

You can create a custom dialog.

you can simply call the AlertDialog.Builder and set your image in there as setIcon(Drawable )
this way you will be able to put up you image on Dialog..

Similar to what Abhinava said, you can also create an ImageView, place your bitmap in there, and send the ImageView to the builder using AlertDialog.Builder.setView(View).
The difference here being that your bitmap will be shown in the content area of the alert dialog instead of in the title.

Related

How to design custom alert dialog in android

I have to implement the filters as shown in the image. Which view or component can I use? Popup view or Alert dialog or anything else?
Also, I have implemented my list using an array adapter and I have filter items in that.
[enter image description here][1]
[1]: https://i.stack.imgur.com/3fuWG.jpg
I'd recommend you to use dialog fragments.
You can read my article on medium on how to create dialog fragment
https://islamassem.medium.com/custom-dialog-using-dialog-fragments-de6a0874b6a4

How to change the default grey color of the alert dialog box in android

i am looking for ways to change the default color of alert box in android to different color like green or blue. please suggest me ways with exampls
Hi there are you try the following.
1)using setview method of alertdialog to set the view and set the view background as per your choice.
2)you can set the your user defined theme and use it in constructor of your dialog.
3)extend dialog class and in oncreate method decorate your dialog box as per your need.
I just shared the idea with which you can achieve your need.For more info visit the following link.
http://developer.android.com/reference/android/app/AlertDialog.html
cheers...

image in the footer frame of an alert dialog

I would like to put an image in the footer frame of the alert dialog.
can someone please tell if it is possible, and how?
I know it is possible to create a custom dialog, is it the only way?
Have a look at this, which gives a idea to create custom alertdialog.
http://android-er.blogspot.com/2011/06/custom-alertdialog.html
try to find method related to load a image in alert dialog box and then call that method with the object of AlertDialog.Builder and give image path in that...I dont know whether it will work or not but still we can try it...

Android dialog or floating activity off-center

Is it possible to have an Android Alert box or Dialog off-center? I have tried everything that comes to mind, including making a custom Dialog activity and theme (extending Android:Theme.Dialog), but I have not been able to move it from it's centered position.
Yes you can make the background translucent and fill the entire view, then nest a visible layout within that you can use layout_gravity="top|left" on.
A little off topic, but if you just want to display text, an easier way is to use a toast.
Toast toast = new Toast(new ContextThemeWrapper(getApplicationContext(), R.style.YourDialogStyle));
toast.setGravity(Gravity.LEFT|Gravity.TOP, 0,0);
PopupWindow? An example can be found here: http://www.anddev.org/how_to_create_a_popupwindow-t1259.html

Android AlertDialog Builder Issue with image

I am trying to make a application where a dialog will come from where user will be able to choose an option...
I want the alert dialog like this,,,
An image with the corresponding text
Here is the sample image I am looking ..
http://garr.me/wp-content/uploads/2009/12/sharevia.jpg
I also want to change the "share picture via" text.
Thanks in advance
Tanmay
Please see my answer to this question: android image inside single select

Categories

Resources