Search in sources :

Example 6 with AppWidgetHost

use of android.appwidget.AppWidgetHost in project android_frameworks_base by DirtyUnicorns.

the class AppWidgetHostActivity method onCreate.

@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);
    if (false) {
        if (false) {
            mHost.deleteHost();
        } else {
            AppWidgetHost.deleteAllHosts();
        }
    }
}
Also used : Context(android.content.Context) AppWidgetHostView(android.appwidget.AppWidgetHostView) AppWidgetHost(android.appwidget.AppWidgetHost) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo)

Example 7 with AppWidgetHost

use of android.appwidget.AppWidgetHost in project android_frameworks_base by crdroidandroid.

the class AppWidgetHostActivity method onCreate.

@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);
    if (false) {
        if (false) {
            mHost.deleteHost();
        } else {
            AppWidgetHost.deleteAllHosts();
        }
    }
}
Also used : Context(android.content.Context) AppWidgetHostView(android.appwidget.AppWidgetHostView) AppWidgetHost(android.appwidget.AppWidgetHost) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo)

Aggregations

AppWidgetHost (android.appwidget.AppWidgetHost)7 AppWidgetHostView (android.appwidget.AppWidgetHostView)5 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)5 Context (android.content.Context)5 Before (org.junit.Before)1 Test (org.junit.Test)1