Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Intents and Broadcast Receivers Implicit Intents and Intent Filters Creating Intent Filters

You will need three data elements, one for each type of data allowed.

I don't know how to add 3 different mimeTypes. Ben Jakuben

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.teamtreehouse.timetraveler"
          xmlns:android="http://schemas.android.com/apk/res/android">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <activity android:name=".TimeTravelActivity">
          <intent-filter>
            <action android:name="android.intent.action.SEND"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="octet-stream"/>
           </intent-filter>
        </activity>
    </application>

</manifest>

1 Answer

Hi there,

You're nearly there with your answer. Have a look at the mimeTypes I've added here; I hope that makes sense:

            <intent-filter>
                <action android:name="android.intent.action.SEND"/>
                  <data android:mimeType="image/*"/>
                  <data android:mimeType="video/*"/>
                  <data android:mimeType="text/plain"/>
                  <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

Steve.