Optimize for large screens Collection
Enable your app to support an optimized user experience on tablets, foldables, and ChromeOS devices.
<uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera.any" android:required="false" /> <uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> <uses-feature android:name="android.hardware.camera.flash" android:required="false" />
Support Chromebooks in your camera app
Configure your app manifest to support camera features and make your app available to Chromebook users on Google Play.
if (keyCode == KeyEvent.KEYCODE_SPACE) { togglePlayback() return true } return false
Pause and resume media playback with Spacebar
Enable your app to respond to Spacebar key presses on external keyboards to pause and resume media playback.
val myView = findViewById<View>(R.id.myView).apply { setOnTouchListener { view, event -> when (event.actionMasked) { MotionEvent.ACTION_CANCEL -> { //Process canceled single-pointer motion event for all SDK versions. } MotionEvent.ACTION_POINTER_UP -> { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && (event.flags and MotionEvent.FLAG_CANCELED) == MotionEvent.FLAG_CANCELED) { //Process canceled multi-pointer motion event for Android 13 and higher. } } } true } }
Reject stylus palm touches
Enable your app to identify and reject palm touches during stylus input.
class MyAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder>() { init { stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY } ... }
Manage RecyclerView state
Maintain RecyclerView state during configuration changes.
@Override protected void onCreate(Bundle savedInstance) { super.onCreate(savedInstanceState); if (compactScreen()) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); } ... }
Restrict app orientation on phones but not on large screen devices
Manage your app's orientation for the best user experience on phones and large screen devices.
@Override override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) webView.invalidate() }
Manage WebView state
Manage your WebView state across configuration changes.
class MyAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder>() { init { stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY } ... }
Manage detachable keyboard configuration changes
Learn how to manage detachable keyboard configuration changes.
Have questions or feedback
Go to our frequently asked questions page and learn about quick guides or reach out and let us know your thoughts.