开发者

ANDROID: How can I launch a popup dialog from an notification or long-pressed search button on top of all windows?

开发者 https://www.devze.com 2023-04-02 09:22 出处:网络
I have searched and everything is about launching an activity not a dialog. What I want to do is to display a notification in the status bar, and when the user presses it a dialog pops up on top of w

I have searched and everything is about launching an activity not a dialog.

What I want to do is to display a notification in the status bar, and when the user presses it a dialog pops up on top of whatever the user was viewing before s/he clicked the notification. I dont want the dialog to show on top of the main activity or the recent apps list.

Also, how can i launch the dialog from long 开发者_StackOverflow社区pressing the search button?

Thanks!


I'm copying from here: Here is answer

to Start activity as dialog i defined

<activity android:theme="@android:style/Theme.Dialog">

now when i startActivity() it display like dialog and parent activity display on back, i wan a button to whom i click dialog should dismiss and parent activity should display without refreshing the page.

And then somebody added the comment:

Using the android:theme="@android:style/Theme.Dialog" is the way to go but don't forget to use excludeFromRecents=true or else your dialog will appear in the Recently Used Apps (hold the Home key).

And for the long press, override onKeyLongPress(int keyCode, KeyEvent event) and you can make the long press do what you want. http://developer.android.com/reference/android/view/View.html

0

精彩评论

暂无评论...
验证码 换一张
取 消