Skip to content Skip to sidebar Skip to footer

Android: Adding Data To Intent Fails To Load Activity

I have a widget that supposed to call an Activity of the main app when the user clicks on widget body. My setup works for a single widget instance but for a second instance of the

Solution 1:

I think you need a <data> tag in your <intent-filter> in order for the intent you are firing to match the intent-filter you have registered.

https://developer.android.com/guide/topics/manifest/data-element.html

Also using Uri.EMPTY may be a problem. I'd create your own Uri scheme, so that your setData() call looks something like:

di.setData(Uri.withAppendedPath(Uri.parse("droidln://widget/id/"), String.valueOf(appWidgetId)));

and your intent-filter would look like:

<intent-filter><actionandroid:name="bostone.android.search.RESULTS" /><categoryandroid:name="android.intent.category.DEFAULT" /><dataandroid:scheme="droidln"/></intent-filter>

Post a Comment for "Android: Adding Data To Intent Fails To Load Activity"