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

Kyle Baker
Kyle Baker
8,211 Points

this challenge should be easier

Directions... Add an Intent filter to the TimeTravelActivity here in the manifest that handles this kind of Intent. Configure it to accept plain text, video, and image messages. You may want to visit Common Intents for help!

It has a link to "help" you, however I could not find anything on image mimeTypes and or video for that matter (there is... <data android:type="audio/*" /> <data android:type="application/ogg" /> ... but that's not a mimeType like it wants).

I tried looking them up elsewhere but there's simply too many of them to hope to choose the correct one's in this lifetime. If anyone has already hacked this, I'd love to be let in on your secret. Thanks

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="text/plain"/>
                <data android:mimeType="audio/*" />
                <data android:mimeType="application/ogg" />
                <data android:mimeType="image/png"/>
            </intent-filter>
        </activity>
    </application>

</manifest>

1 Answer

Kyle Baker
Kyle Baker
8,211 Points

found my answer

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

seems that you can get all the mimeTypes of video and image with an asterisk. at least it makes sense in the end