0
我有一個主屏幕小部件,它是用listview中的數據填充的。每一行都與一個鏈接相關聯,並且在點擊一個項目時,我想打開關聯的網址。如何從主屏幕小部件的列表視圖打開外部鏈接?
我已經設置了除onclicklistener每個項目以外的所有設置。我遇到過類似的問題,但他們都是打開一個活動,而我想打開一個外部鏈接。
這裏是延伸的AppWidgetProvider我從類的onUpdate():
@Override
public void onUpdate(final Context context, final AppWidgetManager appWidgetManager, final int[] appWidgetIDs) {
for (int i = 0; i < appWidgetIDs.length; i++) {
final RemoteViews remoteViews;
final int id = appWidgetIDs[i];
remoteViews = new RemoteViews(
context.getPackageName(),R.layout.widget_layout);
remoteViews.setRemoteAdapter(R.id.widget_list,
getIntent(context, id));
updateWidget(appWidgetManager, id, remoteViews);
super.onUpdate(context, appWidgetManager, appWidgetIDs);
}
,這裏是我的getViewAt()從RemoteViewsFactory:
@Override
public RemoteViews getViewAt(int position) {
row = new RemoteViews(context.getPackageName(), R.layout.widget_row);
final ModelClass modelClass = AppWidget.filteredList.get(position);
row.setTextViewText(R.id.title, modelClass.getTitle());
return row;
}
如何包裹意圖的URL,以及如何檢索我的AppWidgetProvider的URL? – syfy
你知道我不能回答,沒有看到你所描述的先生的結構。 – Remario
更新了問題。 – syfy