title: Why does a protected android:onClick method in Activity actually work?
body: <p>Suppose you define <code>android:onClick="doClick"</code> in your <code>Activity</code> as</p>
  
  <pre><code>protected void doClick(View view) { }
  </code></pre>
  
  <p>The <a href="https://developer.android.com/reference/android/view/View.html#attr_android:onClick" rel="nofollow noreferrer">documentation</a> states that</p>
  
  <blockquote>
    <p>This name must correspond to a public method that takes exactly one parameter of type View.</p>
  </blockquote>
  
  <p>This is a given requirement of the underlying <code>Class.getMethod()</code> method, which only finds public methods as the <a href="https://developer.android.com/reference/java/lang/Class#getmethod" rel="nofollow noreferrer">documentation</a> states that it</p>
  
  <blockquote>
    <p>Returns a <code>Method</code> object that reflects the specified public member method of the class or interface represented by this <code>Class</code> object.</p>
  </blockquote>
  
  <p>So how is it possible, that this implementation, which should not work at all, works on some devices and emulators, while it doesn't work on others using the same API levels as well?</p>