Dismiss android activity displayed as Popup
Posted
by
Sit
on Stack Overflow
See other posts from Stack Overflow
or by Sit
Published on 2012-06-29T15:05:55Z
Indexed on
2012/06/29
15:16 UTC
Read the original article
Hit count: 192
So i have a service, that starts an activity displayed as a Popup thank's to "android:style/Theme.Dialog"
This Activity shows a Listview, with a list of application. On each element of the listview, there is a short description of the application, and two buttons. 1 for launching the application 2 for displaying a toast with more informations.
Here is the code in my service : it starts the activity
Intent intent = new Intent(this, PopUpActivity.class);
intent.addFlags(Intent.FLAG_DEBUG_LOG_RESOLUTION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
this activity uses a custom layout, with a listview, adapted with a custom ArrayAdapter
In this adaptater, i've put an action on the start button in order to start the current application
Button lanceur = (Button) v.findViewById(R.id.Buttonlancer);
lanceur.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
p.start(mcontext);
}
});
with p.start, i start the application.
But now, if i press "back" from the application, i go back to the popup... and i can start another application. I don't want it to be possible.
That's why i wish i could dismiss/destroy/finish my PopupActivity, but i can't manage to do it with the code i have.
© Stack Overflow or respective owner