Can't use setForeground method on ImageView

I want to use the setForeground method to show a “play” icon in the center of my ImageView to indicate the user that a video will play if they press it.

Currently I’m having this error which I cannot solve:

  • appwidget freezes and refuses to update anymore: ignores updateAppWidget
  • Android: PhoneGap vs Webview
  • PreferenceFragmentCompat requires preferenceTheme to be set
  • Strange behavior in do/while statement on Galaxy S5 and Android 5.1.1
  • Enter text into an EditText which then disappears when user clicks inside it
  • how to fix screen overlay detected programmatically
  • enter image description here

    Although the documentation says the method should be available since API 1:

    enter image description here

    I’m targeting and compiling against API 23 with build tools version 23.0.1. I’m targeting min API 16.

    Related posts:

    Android - Storing/retrieving strings with shared preferences
    react-native: command not found
    Android-Execution failed for task ':app:transformClassesWithDexForAvsDebug'
    Finding Android SDK on Mac and adding to PATH
    Android Library Project Jar + IntelliJ IDEA 11
    Android sdk download/update failing
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.