views:

128

answers:

0

I have a Live Folder that lists custom content from a SQLite DB. When an item is clicked, the detail page for that item should be displayed using this URI: content://com.langley.app/item/detail/# (e.g. content://com.langley.app/item/detail/100). Whenever I test this using the "am start" command, the detail activity loads perfectly.

However, when I try to click on the item in the Live Folder, I get the "cannot find Activity" error message. When I compare the parameters that are being used to start the activity, they are exactly like the parameters I am using through "am start". I am not sure what is going on.

Here is my Activity def:

    <activity android:name="ItemDetailActivity">
    <intent-filter>
    <action android:name="android.intent.action.VIEW"></action>
    <category android:name="android.intent.category.DEFAULT"></category>
<data android:scheme="content" android:host="com.langley.app" android:pathPrefix="/item/detail"></data>   
    </intent-filter>
    </activity>

Here is how my base intent is defined in the Live Folder:

// Item.CONTENT_URI = content://com.langley.app/item
intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT,
                new Intent(Intent.ACTION_VIEW, Uri.withAppendedPath(Item.CONTENT_URI, "detail")));

Here is my call to "am start" (this works):

am start -D -a android.intent.action.VIEW -d content://com.langley.app/item/detail/100

I also compared the logcat messages for the 2 start attempts:

**FAILED**
I/ActivityManager(   60): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.langley.app/item/detail/1 flg=0x10000000 }

**WORKED**
I/ActivityManager(   60): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.langley.app/item/detail/1 flg=0x10000000 cmp=com.langley.app/.ItemDetailActivity }

Help is appreciated.


Per my comment below, I was able to change the base intent declaration to what you see below to get it working, but this seems like a hack since Intent should be able to be broadcast and received (and I still don't get why it works from "am start" but not the Live Folder directly).

// Item.CONTENT_URI = content://com.langley.app/item
intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT,
                new Intent(Intent.ACTION_VIEW, Uri.withAppendedPath(Item.CONTENT_URI, "detail"), context, ItemDetailActivity.class));