title: How to prevent screenshot with a nice message?
body: <p>The easiest way to prevent a screenshot for an activity in Android is to set the <code>LayoutParams.FLAG_SECURE</code> flag. It's a pretty safe option because it's an SDK feature specifically for that purpose.</p>
  <p>The downside is that when taking a screenshot, it shows a system message that does not make for an appealing UX. The message looks pretty technical and some may even read this in a way that the app had a bug:</p>
  <blockquote>
  <p>Unable to take screenshot due to system error or because it is not allowed to take screenshots for this app.</p>
  </blockquote>
  <p>Is there a way to prevent a screenshot with a nicer message to the user?</p>