views:

120

answers:

2

In my desperation with trying to get LiveFolders working, I have tried the following in my LiveFolder ContentProvider:

public Cursor query(Uri uri, String[] projection, String selection,
        String[] selectionArgs, String sortOrder) {
    MatrixCursor mc = new MatrixCursor(new String[] { LiveFolders._ID, LiveFolders.NAME, LiveFolders.INTENT } );
    Intent i = null;

    for (int j=0; j < 5; j++) {
        i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com/"));
        mc.addRow(new Object[] { j, "hello", i} );
    }

    return mc;
}

Which, in all normalness, should launch the Browser and display the Google homepage when clicking on an item in the LiveFolder. But it doesn't. It gives a Application is not installed on your phone error. No, I'm not defining a base intent for my LiveFolder.

logcat says:

I/ActivityManager(   74): Starting activity: Intent { act=android.intent.action.VIEW dat=Intent { act=android.intent.action.VIEW dat=http://www.google.com/ } flg=0x10000000 }

It seems it embeds the Intent I give it in the data section of the actually fired Intent. Why is it doing this? I'm really starting to believe it's a platform bug.


Update: I have filed an issue and removed the LiveFolders feature. I will include it in my app when I'll get a response either here or there that clarifies this thing. If I get the time I think I'll upload a demo app to that issue.


Update: I have received a notification that the bounty is expiring in 3 days. No one wants it? :)


Update 04/25/2010: I have updated the issue on the Android project and uploaded a test application. It would be nice if someone could test this application on a device, maybe it's such a subtle problem that it only appears on the emulator.

A: 

Can you try hardcoding component name.

Intent intent = new Intent();
ComponentName comp = new ComponentName("com.google.android.browser",
                                   "com.google.android.browser.BrowserActivity");
intent.setComponent(comp);
intent.setAction("android.intent.action.VIEW");
intent.addCategory("android.intent.category.BROWSABLE");
Uri uri = Uri.parse(url);
intent.setData(uri); 
Vinay
Thanks for the answer, but the same thing happens (application not installed error). In logcat I get: `Starting activity: Intent { act=android.intent.action.VIEW dat=Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://www.google.com/ cmp=com.google.android.browser/.BrowserActivity } flg=0x10000000 }`
Felix
+1  A: 

Hi,

I face the same; and can unfortunately confirm it: The intent is wrapped into the data part of the intent to be fired.

I an wondering if the other predefined CURSOR-columns are evaluated correctly; I thought about filing a bug for the case custom icons (per entry, not one for all of them) are to be returned; but failed. In the whole web I did not find any example or person who were successfull using these columns; only name and id seem to work.

This is one of the main USP features of Android, and it looks like it just failed to be accepted commonly.

Flo
sad.. especially because no one has yet to respond to my issue on the android project..
Felix