LauncherIntent and setting intents for scrollable widget items

75 views
Skip to first unread message

Driverman

unread,
Sep 26, 2011, 3:30:10 PM9/26/11
to android-appwidget-extensions
I'm not sure if I'm asking this in the wrong place (my apologies if
this is the case), but here goes:

I am developing a scrollable widget. Using the examples that I
located, I was able to get it working almost exactly as I want.
However, I am having issues with making the list items clickable. I
have callbacks set up that, unfortunately, only give me the position
of the clicked item. This information, while technically workable, is
not ideal to me. What I'd like to do, ideally, would be to set an
intent for each item that can be retrieved from my ContentProvider. I
added an additional column and populated it accordingly along with
everything else, but I don't know how to tie this data to the items on
the list. From what I can tell, I'm going to need to use
BoundRemoteViews. Basically what I want to do is launch the following
intent, thus opening to a web browser and directing it to a specific
link:

Intent viewIntent = new Intent(Intent.ACTION_VIEW);
viewIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
viewIntent.setData(Uri.parse(item.getLink()));

I am very lost as to how to set up my intents to do this. Thanks for
any help.

roee88

unread,
Oct 5, 2011, 3:00:26 PM10/5/11
to android-appwidget-extensions
Learn from this example:
http://code.google.com/p/scrollablecontacts/source/browse/trunk/src/com/boombuler/widgets/contacts/ContactWidget.java
You can see that it bounds a column from the content provider (in this
case DataProvider.DataProviderColumns.contacturi) to
LauncherIntent.Action.ACTION_ITEM_CLICK using the extra parameter
LauncherIntent.Extra.Scroll.EXTRA_ITEM_POS.
Reply all
Reply to author
Forward
0 new messages