When using 'android.intent.action.SEND' the receiving activity doesn't go back to the activity that initiated the share

Viewed 1258

I have an app that has two activities.

  • ConfigActivity
  • ShareActivity

ConfigActivity is also the default activity for the app. The ShareActivity is only accessed when another application shares something i.e. the Gallery sharing a photo.

ShareActivity collects some information from the user and then finishes. The problem is when ShareActivity calls finish() ConfigActivity is shown. I want the Gallery or whichever app that initiated the share to come back.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.testapp"
    android:versionCode="5"
    android:versionName="2.0beta" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <application android:name=".TestApp"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Holo" >

        <activity
            android:name="com.example.testapp.ConfigActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.example.testapp.SettingsActivity"
            android:label="@string/title_activity_settings" >
        </activity>

        <activity
            android:name="com.example.testapp.ActivationActivity"
            android:label="@string/title_activity_settings" >
        </activity>

        <activity
            android:name="com.example.testapp.ShareActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
            </intent-filter>
        </activity>

        <service android:name=".MemoryService">
            <intent-filter>
                <action android:name="com.example.testapp.action.send_to_media_gateway" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
            </intent-filter>
        </service>

    </application>

</manifest>

I tried a different scenario. I force stopped my app. I go into the devices Gallery and share an image. I select my app to share with which loads ShareActivity. I submit the information and it goes back to Gallery as I want. Then I ran my app which loads ConfigActivity since it's the main activity. If I then go to Gallery and attempt to share an image via ShareActivity when it's finished it goes to ConfigActivity and not the Gallery.

1 Answers
Related