2010-02-14 38 views

回答

2

我只是救數據到首選項。 Widget在顯示時會讀取這些首選項。無論如何,你必須使用首選項來堅持選定的選項。

+0

這就是我最終解決它的方法。 – 2010-08-02 08:29:57

+1

關於如何將數據保存到首選項的一些鏈接將有所幫助。 – jrharshath 2013-07-30 06:13:30

1

不能確定這是否是你在尋找什麼,但是從配置屏幕設置RemoteViews,我使用以下命令:

AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); 

RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); 

// Set RemoteViews     
views.setTextViewText(R.id.textview, text); 

appWidgetManager.updateAppWidget(mAppWidgetId, views); 

// User is finished configuring, effectively closing the configure screen. 
Intent resultValue = new Intent(); 
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); 
setResult(RESULT_OK, resultValue); 
finish(); 

點擊此處瞭解詳情:http://developer.android.com/guide/topics/appwidgets/index.html#Configuring