How to hide blank/black activity window behind the Dialog - android

I have one Activity which displayed some Dialog boxes and Progress bars.
This activity does not have call to setContentView as this Activity does not have Screen Layout. It has been just used for displaying Dialogs and progress bar dialogs.
Now what happens is that Activity Displays Dialog box along with the Blank Activity Window on back of the Dialog, So i want to hide make it transparent so it will look like we are just displaying Dialog.
Thank,
PP.

Use this attribute for your activity
<activity android:theme="#android:style/Theme.Translucent">
This will make activity background transparent.
In your activity tag(in manifest) which is displaying progressbar or dialog
put this above attribute android:theme="#android:style/Theme.Translucent
This will work...

Try applying the dialog theme to this activity:
In your manifest file add to the activity element this attribute: android:theme="#android:style/Theme.Dialog"

Copied from background - Android: make everything around dialog darker
All you need to do is play around with the dimAmount field in the
WindowManager.LayoutParams:
WindowManager.LayoutParams lp = myDialog.getWindow().getAttributes();
lp.dimAmount = 0.7f

Related

how to change activity transparency dynamically

I want to change the transparency of activity dynamically when I move the root element/view. How to do that?. I'm creating a module for which when user slide down the whole UI down to half of the screen vertically to finish the activity. But by default when the user slides down the layout default color white of activity is shown and when I set its theme to transparent previous activity is shown. I want to change the opacity of activity window dynamically when user slides down.
use this where you need:
Window window = this.getWindow();
window.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

How to hide the main activity when showing a dialog activity

My appliation do the following:
Start a alarm
after 10 second
open a Activity (ThemeDialog)
The output is as follows
I would like to do the following:
Just show the dialog without showing the main activity
But the current situation is that the main activity is opened when I open my dialog activity.
How to hide it (when the alarm timesup, i just want to display a dialog)? Just like the following screen shot:
http://www.whatsappen.nl/wp-content/uploads/2012/05/popup21.jpg
You just also finish activity and than open new activity. New Activity' s style to android:theme="#style/Theme.Translucent" in your manifest file. And than set a view maybe empty textview, open dialog.
you can acheive this by using custom dialog
.in this give background color to black it will hide back activity
or you can acheive this by launching activity as dialog
Start activity as dialog i used this
<activity android:theme="#android:style/Theme.Dialog" />
now when i startActivity(in) it displays like dialog.
instead of showing dialog in activity you can directly use dialog theme in manifest file for activity.and use that activity as a dialog box.

How to create ProgressDialog without obscuring the background window

I've got a little problem. When I use the showDialog() method of my Activity, it generates a perfect ProgressDialog, but the activity on the background (as the dafault behaviour) and becomes darker.
How can I avoid the darkening of my activity?
Try this:
Window window = dialog.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

AlertDialog buttons always close the dialog once clicked

I'm using an AlertDialog with 2 buttons (one positive, one negative).
I've set a handler for those buttons which doesn't mention dismiss. Indeed after clicking, I don't want the dialog to close. However, it seems that as soon as we click on a positive/negative button on an AlertDialog, it always get closed.
Is there a way to prevent the dialog from closing after clicking on any button ?
Thanks,
Vincent
Use custom layout for Dialog and you will be happy!
Use a custom dialog, not an AlertDialog.
You can also create a new Activity and assign it the theme dialog in your manifest with
<activity android:name="MyDialogActivity" android:theme="#android:style/Theme.Dialog" />

show pop-up from background service in android

Hi it is possible in android to show pop-up dialog from background running service?
and answer is positive than how can i do that
There are several options. You can use a theme and make an activity look and behave like a dialog (as in this question) by setting the android:theme attribute of your <activity> to #android:style/Theme.Dialog or a customized theme in your manifest.
Alternatively, you could create a translucent activity by setting the theme to #android:style/Theme.Translucent.NoTitleBar and then launch a regular dialog from the activity. As the comments on one of the answers to the question advise, in this case just make sure to finish() the translucent activity whenever the dialog is dismissed.

Categories

Resources