Merge "fix RuntimeException when inflating default layout for AdapterView-based widgets" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-05-19 17:13:04 +00:00
committed by Android (Google) Code Review

View File

@@ -625,7 +625,10 @@ public class AppWidgetHostView extends FrameLayout {
}
}
defaultView = inflater.inflate(layoutId, this, false);
defaultView.setOnClickListener(this::onDefaultViewClicked);
if (!(defaultView instanceof AdapterView)) {
// AdapterView does not support onClickListener
defaultView.setOnClickListener(this::onDefaultViewClicked);
}
} else {
Log.w(TAG, "can't inflate defaultView because mInfo is missing");
}