Android: Adding data to Intent fails to load Activity

前端 未结 1 1259
予麋鹿
予麋鹿 2021-02-10 07:44

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 t

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-10 07:48

    I think you need a tag in your 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:

        
            
            
            
        
    

    0 讨论(0)
提交回复
热议问题