• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Added App to Share menu...now what

guyncothal

Lurker
Apr 29, 2011
2
0
So i have followed the MANY tutorials on how to add your app to the SHARE menus using android.intent.action.SEND in the manifest...I can't figure out for the life of me how to get the image or display the image or even upload...so here is what i am trying to do...upon click my app in the share menu, it will open up the intent that handles this request...i already have the layout but i need to load the image into the ImageView on the layout itself...once loaded, i will type a caption in an EditText and then click the save Button...then i will upload it to my webserver...i have found all the parts i need to get this done other than how to get the image itself...someone please help...even a link to a tutorial will help
 
In your manifest, the intent-filter element needs to be placed as a child of the Activity element of the Activity that will be launched when the user clicks your app in a share menu. When the Activity is launched, in the onCreate, you need to get the intent using getIntent() and verify that it is a share Intent using getAction().equals(Intent.ACTION_SEND);

An example of how to handle an intent for share is this:

Code:
private void handleIntent() {
	    	Intent intent = getIntent();
	    	String action = intent.getAction();
	    	String type = intent.getType();
	    	Log.e("COMPOSE", action + " " + type);
	    	if (action != null && type != null) {
	    		if (action.equals(Intent.ACTION_SEND)) {
	    		      if (type.startsWith("image/")) {
                                        Uri imageUri = (Uri)intent.getParcelableExtra(Intent.EXTRA_STREAM);
	    				//Do what you need to do with the image URI here.
	    			}
	    		}
	    	}
	    }
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones