From 2c1a63fe9926839dd2cdfe865e749f83c26bf3ca Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Mon, 10 Jan 2011 22:58:05 -0800 Subject: Update AppWidgetHostActivity to work again. Change-Id: I301b59ef49423d45b052edb350856421c7844fba --- .../tests/appwidgethost/AppWidgetHostActivity.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'tests/appwidgets/AppWidgetHostTest') diff --git a/tests/appwidgets/AppWidgetHostTest/src/com/android/tests/appwidgethost/AppWidgetHostActivity.java b/tests/appwidgets/AppWidgetHostTest/src/com/android/tests/appwidgethost/AppWidgetHostActivity.java index bb0fa60..2c8c5ba 100644 --- a/tests/appwidgets/AppWidgetHostTest/src/com/android/tests/appwidgethost/AppWidgetHostActivity.java +++ b/tests/appwidgets/AppWidgetHostTest/src/com/android/tests/appwidgethost/AppWidgetHostActivity.java @@ -46,14 +46,22 @@ public class AppWidgetHostActivity extends Activity AppWidgetContainerView mAppWidgetContainer; public AppWidgetHostActivity() { - mAppWidgetManager = AppWidgetManager.getInstance(this); } @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); + mAppWidgetManager = AppWidgetManager.getInstance(this); + setContentView(R.layout.appwidget_host); + mHost = new AppWidgetHost(this, HOST_ID) { + protected AppWidgetHostView onCreateView(Context context, int appWidgetId, AppWidgetProviderInfo appWidget) { + return new MyAppWidgetView(appWidgetId); + } + }; + + findViewById(R.id.add_appwidget).setOnClickListener(mOnClickListener); mAppWidgetContainer = (AppWidgetContainerView)findViewById(R.id.appwidget_container); @@ -188,11 +196,7 @@ public class AppWidgetHostActivity extends Activity } } - AppWidgetHost mHost = new AppWidgetHost(this, HOST_ID) { - protected AppWidgetHostView onCreateView(Context context, int appWidgetId, AppWidgetProviderInfo appWidget) { - return new MyAppWidgetView(appWidgetId); - } - }; + AppWidgetHost mHost; } -- cgit v1.1