Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have an Activity A, and there is a button B in the view. If somebody presses B then I want a pop-up which can take some part of screen making the A invisible in that area but rest of A is visible but not active. How can I achieve this?

like image 893
bhups Avatar asked Jul 28 '10 09:07

bhups


People also ask

How do I make an activity pop up?

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).

How do I stop activity from another activity?

If you want to finish you activity then you can simply send a broadcast from your activity B to activity A. Intent intent = new Intent("finish_activity"); sendBroadcast(intent);


2 Answers

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).

like image 189
oli Avatar answered Sep 24 '22 11:09

oli


For AppCompat, add

android:theme="@style/Theme.AppCompat.Dialog.Alert" 

to the activity in AndroidManifest

like image 27
Actiwitty Avatar answered Sep 23 '22 11:09

Actiwitty