Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do they do it? Dialogs over home screen

I'm writing an Android application and I would like to place a dialog or view over the home screen so that a user can enter text without jumping into my full application. I can't seem to get this to work. If I present a dialog (even in a transparent activity), my application launches.

If you don't know what I'm talking about, take a look at the Facebook widget. I want to replicate a similar behavior to the clicking on the "What's on your mind?" box.

Thanks for any help in advance!

-Brian

like image 794
strange quark Avatar asked Apr 24 '10 16:04

strange quark


People also ask

How to show a DialogFragment?

Showing the DialogFragment It is not necessary to manually create a FragmentTransaction to display your DialogFragment . Instead, use the show() method to display your dialog. You can pass a reference to a FragmentManager and a String to use as a FragmentTransaction tag.

When a dialog is displayed on top of your activity what will happen?

Displaying the dialog-as-an-Activity will cause the new Activity to be on the top of the stack, pausing what previously was there. There are two more such scenarios when onPause() will get called.

What is dialog in android?

A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed. Dialog Design.

How do you check if the current activity has a dialog in front?

You can override activity method onWindowFocusChanged(boolean hasFocus) and track the state of your activity. Normally, if some alert dialog is shown above your activity, the activity does not get onPause() and onResume() events.


1 Answers

My problem was that the application always launched to display the dialog.

To solve this, I set the activity lauch mode to singleInstance in the manifest. Now it shows the dialog over the home screen!

like image 175
strange quark Avatar answered Sep 30 '22 05:09

strange quark