Example usage for android.appwidget AppWidgetHostView setOnFocusChangeListener

List of usage examples for android.appwidget AppWidgetHostView setOnFocusChangeListener

Introduction

In this page you can find the example usage for android.appwidget AppWidgetHostView setOnFocusChangeListener.

Prototype

public void setOnFocusChangeListener(OnFocusChangeListener l) 

Source Link

Document

Register a callback to be invoked when focus of this view changed.

Usage

From source file:com.android.launcher3.Launcher.java

private void addAppWidgetToWorkspace(AppWidgetHostView hostView, LauncherAppWidgetInfo item,
        LauncherAppWidgetProviderInfo appWidgetInfo, boolean insert) {
    hostView.setTag(item);/*from   w w  w  . ja va  2 s .com*/
    item.onBindAppWidget(this, hostView);

    hostView.setFocusable(true);
    hostView.setOnFocusChangeListener(mFocusHandler);

    mWorkspace.addInScreen(hostView, item.container, item.screenId, item.cellX, item.cellY, item.spanX,
            item.spanY, insert);

    if (!item.isCustomWidget()) {
        addWidgetToAutoAdvanceIfNeeded(hostView, appWidgetInfo);
    }
}