Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude my own Activity from Activity.startActivity(Intent) chooser?

My app works with pictures. It can take multiple pictures as an input, process them, and send them again to another app.

As a consequence, my main Activity has declared an intent filter on ACTION_SEND_MULTIPLE for image/* mimetypes and can result in issuing a new Intent with the same action and data type using Activity.startActivity(Intent).

Is there a way to exclude my own activity from the list of apps that is displayed to the user after the startActivity() call ?

like image 792
Kevin Gaudin Avatar asked Oct 17 '10 23:10

Kevin Gaudin


People also ask

What is the different between setContentView () function and startActivity () function?

So, with respect to time, setContentView alone is faster, since it doesn't start a new activity. Hence, your app will show the new screen faster... On the other hand, if you call startActivity, this activity is put on the stack, so you can go back by pressing the back button.

How do you pass an activity in intent?

The easiest way to do this would be to pass the session id to the signout activity in the Intent you're using to start the activity: Intent intent = new Intent(getBaseContext(), SignoutActivity. class); intent. putExtra("EXTRA_SESSION_ID", sessionId); startActivity(intent);

Is startActivity asynchronous?

startActivity() is asynchronous. The other activity will not show up until sometime later, particularly after you return from whatever callback you were in when you called startActivity() (e.g., onClick() of some View.


1 Answers

Not directly, AFAIK. However, you could create your own chooser using PackageManager and queryIntentActivityOptions(), which does allow for filtering yourself (or other things) out.

like image 187
CommonsWare Avatar answered Nov 05 '22 16:11

CommonsWare