How to show an Activity as pop-up window on other Activity? - android

I have a ListActivity act as dialog. It's fine. when i select item click show another listactivity as dialog. But i want to show second listactivity as pop up window based activity. Already i have set manifest file android:theme="#android:style/Theme.Dialog". Two list activity show but pop up windows not indicate specific item. is it possible we can do? Already have this question in stackoverflow. I know some code are missed. what are the steps. pls help me. Advanced thanks,

Android activity can create as dialog and. activity can run single screen only. multiple activity run on fragment only. you can't make popup window as a activity.

Set below property in manifest for the activity which you want to be open as dialog:
<activity android:theme="#android:style/Theme.Dialog" />

Related

Display dialog box before intent activity starts in android

I'm creating an application in which I've to display a dialog box. This dialog box having an edittext and a button. I want to display this dialog box before activity starts. please help me.
Create an instance of dialog in onCreate(); and show it in onResume();
you can use a dialog fragment:
http://developer.android.com/reference/android/app/DialogFragment.html
this is an example of how to use it:
check out this tutorial
there are some ways where what you can do is you can have a activity which is registered as
<activity android:theme="#android:style/Theme.Dialog" />
at manifest and show the activity before yours activity that it will be an appearance of dialog beside this
visit
How do I display a dialog in android without an Activity context?

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.

Customized alert box or default alert box inside service in Android [duplicate]

I have read really a lot of posts about this topic, however nothing works for me (or doesn't have the effect I wish).
I have a an application, that after logging in starts a background Service (implementation of the Service class). This service syncs itself with a Server and if a new order comes, it creates a notification.
So far, everything works great, I have the notification and the Toast message. However, I would like to have a dialog, that notifies the user about the new order.
As I understood, you can start an activity from within the service, which displays the dialog. This works, but the activity starts on top of the current activity stack and displays the dialog. I have an activity with no view attached and it correctly displays the dialog, however, on a black background.
What I want is to display the dialog on the current activity, causing the actual background(the running activity) to fade and display the dialog.
Is this somehow possible?
We can show dialog from service only if it is a system alert dialog. So, set TYPE_SYSTEM_ALERT window layout parameter to Dialog as follows:
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
But, it needs SYSTEM_ALERT_WINDOW permission. So, don't forget to add this permissin in Manifest file.
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
Edit:
Better option to show dialog is to start activity as one of the below ways.
Start Activity with Dialog Theme (android:theme="#android:style/Theme.Dialog") -(or)
Start Translucent Activity and show Dialog in it.
Note: You should add Intent.FLAG_ACTIVITY_NEW_TASK to intent
I highly, highly, HIGHLY recommend that you DON'T do this (it goes against Android design and UI guidelines). Notifications are the preferred way to accomplish what you are doing (which it sounds as if you have already accomplished).
That being said, if you must do it, I would recommend just using a Dialog themed activity. That way you don't have to start up a separate dialog. Please see http://developer.android.com/guide/topics/ui/themes.html#ApplyATheme for how to do this.
you can start by learning on how to create an activity that looks like a dialog (no title bar, transparent background, "floating" effect, etc.)
and no, you can't just start a dialog without an activty
No, you can't hijack activity that is not "yours" and command it to show dialog.
Your approach of starting your own activity is the classic one.
You cannot show a dialog. But you can go the alernative way by inflating your customized view so that you can show a dialog on the screen whenver certain conditions are met.

Semi Transparent Activity like Popup window

I want to make Semi Transaparent Activity Like pop window i.e. As my appActivity starts one pop up window on top that should come and user should click proceed button to go on that activity. I have seen dialog as well as Alert Box but they are widget. I want to use the screen as activity so that I can put xml layout .
I have come across PopWindow but I do not know how to use it .I have made one class PopupWindow When I try to achieve findviewbyid I am unable to achieve it becoz PopupWindow class is not extending anything ....
So what should i use if popWindow class then how to use it ? thanks
create an layout as you like to have as a dialogue and create an activity using that layout.
in the manifest declare that activity and add android:theme="#android:style/Theme.Dialog in that activity stub.

Android Keyboard automatically appears for EditText when activity is created

I have a single activity class and it has a two EditTexts on the screen. When the activity launches the keyboard launches with it. Why is this? I did not request enter anything yet into the edit box. Why does it do this? And how can I get rid of this behavior?
Try setting your stateHidden in the manifest file for the activity:
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
and this might be helpful:
How to keep soft keyboard from opening on activity launch in Android?

Categories

Resources