Is it possible to launch an Android Activity from an AlertDialog? - android

I am trying to create a small pop-up in my Android application to let the user choose from one of many items, ala a ListView. I am hoping to make it show up as a translucent box that overlays on the screen, as opposed to completely occupying it like Activities usually do.
One technique for doing this that I've heard is possible is to launch an Activity in an AlertDialog box. This would be perfect - it's the ideal size and has a lot of the mechanical properties I'm looking for, but I'm totally unable to find any more specifics of this technique.
Is this possible? And if not, what is the preferred way of accomplishing something like this?

This should answer your question: http://developer.android.com/guide/topics/ui/themes.html
Quote: For example, you can use the Dialog theme to make your Activity appear like a dialog box. In the manifest, reference an Android theme like so:
<activity android:theme="#android:style/Theme.Dialog">

Maybe you could just display AlertDialog http://developer.android.com/guide/topics/ui/dialogs.html

Related

Lock screen activity

I've been always curious to know how does lock screen notification view works on IMO messenger app?
So I did some research and some articles were saying it's custom notification layout and part of RemoteView class. So I went through some quick tutorial and gave it a try but still I am not really sure whether I'm going right way. So, finally I'm asking over here. Do you guys have any idea/suggestion to any library or any other way that I can come up with following outcome?
Desire
Result so far
Zip file- if you wanna take a look at the code
https://drive.google.com/file/d/0B9Y-jPBRm4zyTHZsT09kd3pUU0E/view?usp=sharing
What you see in the navigation bar (just a back and home buttons) indicates that this is an Activity, placed above the lock screen with usage of the FLAG_SHOW_WHEN_LOCKED:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
The styling where it looks like a dialog can be done by theming your Activity, probably using something like android:theme="#style/Theme.AppCompat.Dialog"

Overflow Menu in Android Studio

I'm working on an app where the Main Activity has an Overflow Menu, that has two option/items in it About and Help. What I want is a way that if I clicked on say About, a card would come up on the screen over the Main Activity (not hiding it completely, being translucent) to show some text. I have looked it up and I have seen people talking about 'Dialogue Boxes'. I don't want that because it doesn't look "Material Designed", so if there is any other way I could achieve it or if there's some way I could make the Dialogue Box look like a "Card floating above the Main Activity".
I can assure you that dialogs are part of the material design, see https://www.google.com/design/spec/components/dialogs.html#dialogs-specs
But if you want to show more than very little information, I'd suggest you create an About activity.
You can use Material Dialog Library

How does WhatsApp pop-up notification work?

I am trying to mimic the pop-up notification of WhatsApp.
(If you have not seen it, it might be a bit hard for you to understand this.)
Below is an image to give a clearer perspective.
Some suggested that this might be done using an oridnary activity which has the Theme.Holo.Light.Dialog.Alert theme. However, when I implemented that I got half of the activity full with the views (and the other half) which is supposed to be empty like a dialog, showing a white background. ie, I did not have the dialog feel.
Morever, when the device is in standby mode (power button pressed) and locked, whatsapp is able to bypass that and show the popup dialog (or activity, or whatever) above that.
Any ideas how to implement this ?
Oh god! After hours, I found the solution!
Refer link:http://developer.android.com/guide/topics/ui/dialogs.html#CustomLayout
It's extremely easy, you just need to set up the theme of the activity to #android:style/Theme.Holo.Dialog in manifest like:
<activity android:theme="#android:style/Theme.Holo.Dialog" >

Android - Show more information on a popup

I'm developing an app that includes reviews of items and due to my design, I want to only show all the reviews in a popup window like in Google Play Store:
What should I use to create that white panel that appears over the current window and contains the necessary information? This should be simple but I'm a newbie and I can't seem to figure out what this "widget" is. Please help me if you are familiar with this so I can use this cool design pattern. Thanks.
It seems you want to display a layout as a popup in another activity.
If you want to do this using an Activity instead of a Dialog, you can do this by setting the activity's theme to android:theme="#android:style/Theme.Dialog" in the manifest - this will make the activity appear like a dialog (floating on top of whatever was underneath it).
A better way to do it would be using a DialogFragment. You can display information in the form of a popup and it will have its own lifecycle. That will be much better than displaying an activity like a dialog
Ram kiran's answer is a good one and one which I like to give also. But just so you have another option to look at you can consider PopupWindow
As stated in the docs, it is
A popup window that can be used to display an arbitrary view. The popup window is a floating container that appears on top of the current activity.
I've used this and it works out nicely in some situations. It really depends on what your exact needs are as to which will work best for you.

How was this made?

This screen was captured from Gmail app for android. The popup looks pretty cool with images and all. Any ideas on how this was made?
This is done with a custom dialog, it is actually quite easy to achieve. Just create a layout for a normal Activity and pass it to the Dialog builder.
For more information, check http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog out

Categories

Resources