本文整理汇总了Java中android.appwidget.AppWidgetManager.ACTION_APPWIDGET_CONFIGURE属性的典型用法代码示例。如果您正苦于以下问题:Java AppWidgetManager.ACTION_APPWIDGET_CONFIGURE属性的具体用法?Java AppWidgetManager.ACTION_APPWIDGET_CONFIGURE怎么用?Java AppWidgetManager.ACTION_APPWIDGET_CONFIGURE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.appwidget.AppWidgetManager
的用法示例。
在下文中一共展示了AppWidgetManager.ACTION_APPWIDGET_CONFIGURE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureWidget
private AppWidgetHostView configureWidget(Intent data) {
// Get the selected widget information
Bundle extras = data.getExtras();
int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
if (appWidgetInfo.configure != null) {
// If the widget wants to be configured then start its configuration activity
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
intent.setComponent(appWidgetInfo.configure);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
mParent.startActivityForResult(intent, REQUEST_CREATE_APPWIDGET);
} else {
// Otherwise simply create it
return createWidget(data);
}
return null;
}
示例2: configureWidget
/**
* Sets up a widget that the user has selected.
*/
private void configureWidget(int appWidgetId) {
AppWidgetProviderInfo appWidgetInfo =
mAppWidgetManager.getAppWidgetInfo(appWidgetId);
if (appWidgetInfo.configure != null) {
Intent intent =
new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
intent.setComponent(appWidgetInfo.configure);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
startActivityForResult(intent, 1);
} else {
createWidget(appWidgetId);
}
}
示例3: startConfigActivity
@Override
public void startConfigActivity(AppWidgetProviderInfo info, int widgetId, Activity activity,
AppWidgetHost host, int requestCode) {
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
intent.setComponent(info.configure);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
Utilities.startActivityForResultSafely(activity, intent, requestCode);
}