share via (Gallery )activity not getting closed after sharing the image - android

I have added my app option in share via option that comes when we share any image in gallery through share via option. I am able to see my app in share via option. But the problem is once the image is shared and after that the gallery is opened then the gallery still shows the app activity which means gallery activity is not finished even after sharing the image. How to overcome this problem ?
Here is the line of code I've added in activity tag in Manifest file :
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>

Related

Get image in activity through "Share" button in gallery | Android

I need to add my application to share list when I click to "Share" button on some image in gallery (for instance) and then I want to get this image in ImageView.
Share List
Thanks for help!
Intent filters inform the Android system what intents your application is willing to accept.
For images, you’d add the following to your AndroidManifest.xml
<activity android:name=".ui.MyActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
When the gallery application tries to share an image by constructing an intent and passing it to startActivity(), your application will be listed as an option in the Android Sharesheet or intent resolver. Upon selecting your app, the corresponding activity (.ui.MyActivity in the example above) will be started. It is then up to you to handle the content appropriately within your code and UI.
More info here
you can check following link here it was mentioned exactly what you want to achieve

How to make app show in pick image from menu

I am kind of stuck here, I have created a gallery app but for some reasons I do not know how to make it be recognized by the system as a gallery app so that I can pick images from it from other apps e.g Whatsapp, I see other 3rd party appearing on the menu except mine.
Add this in your Manifest
<activity android:name="YourActivity">
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
</activity>
And then handle the intent when your activity gets opened and get the URI of the image from the EXTRAS.

How to make my Android App to act as Image Picker [duplicate]

This question already has answers here:
What intent-filters must my app cover to appear in chooser when requestion an image from an external app?
(4 answers)
Closed 8 years ago.
I am developing an Android App which contains image collection with different type of Images.
I want my app to act as Image Picker.
For example when a user want to pick an Image to post on facebook or wahtsapp,chooser dialog gets opened with gallery app option and user select the image to post from gallery. What I want is my app should be listed in Image Picker along with Gallery so that user can select image from my app.
Thanks
Its quite simple. You can register the IntentFilter for that corresponding mime type inside your Activity tag AndoridManifest.xml and your app will also be listed among the apps which can be used to pick images. Code:
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>

Android: intercepting an intent ends with my Activity attached to the opener app

I've developed an Android Application. I've defined an intent-filter so that my app is used to view some links:
<intent-filter>
<data
android:host="my_url.com"
android:pathPrefix="/some_prefix/"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
When I open one link like "my_url.com/some_prefix", my app appears on the selector and, if chosen, its open to display the link.
However, my Activity is opened attached to the application that lauched it. Lets say, for example, that the link is displayed in a WhatsApp message, after opening the link my app is displayed. If I try to open WhatsApp again, my Activity is displayed, instead of WhatsApp.
How can I detach my Application from the Application that called it?
Your activity is being opened in the current 'task', which is the WhatsApp task.
What you are wanting is for your app to be opened in a new task.
There is a flag you can set on your activity in the manifest:
android:launchMode="singleTask"
This will tell android to open your activity in another task.
Read more about tasks here

How can I create an intent to handle opening a photo?

I have my android application manifest file and I made a new activity. I want this activity to be able to handle images just like the built in image viewer. So I can tap an image in the browser, and it will ask if i want to use my application, or the default activity to view the image. What action can I use in the following intent filter:
<intent-filter>
<action android:name="android.intent.action." />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
I assume it would be listed at http://developer.android.com/reference/android/content/Intent.html but I cannot figure out which one is for viewing images.
You are looking for android.intent.action.VIEW
Intent.html#ACTION_VIEW

Categories

Resources