title: What is the correct way to deal with the deprecated Fragment events onAttach and onInflate
body: <p>I have read a few articles and answers (including <a href="https://stackoverflow.com/questions/31321370/about-new-methods-and-deprecated-methods-in-android-apis">this one</a>) regarding deprecated code, but I'm a bit confused as to how to handle (specifically) the deprecated <code>Fragment</code> event handler <code>onInflate</code>. </p>
  
  <p>I have replaced my implementation of </p>
  
  <pre><code>public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState)
  </code></pre>
  
  <p>with</p>
  
  <pre><code>public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState)
  </code></pre>
  
  <p>If I run my app on a &lt; API23 machine, the replacement code is not called. </p>
  
  <p>If I restore the original deprecated code (so that I now have both methods implemented) then the deprecated code is called, correct functionality returns, but a call is now being made to a deprecated method(?).  </p>
  
  <p>And when I run the app on an API23 machine, it appears that BOTH versions of the handler are called.</p>
  
  <p>So the question is, what is happening here? 
  If I am writing code which is supposed to run on both API23 and earlier versions, do I need to implement the deprecated methods as well as the new ones? </p>
  
  <p>And if that's the case, do I need to hunt out and implement other deprecated methods "just in case"? (and, therefore, is there a list of these deprecated methods to "back-code" for?)</p>
  
  <hr>
  
  <p><strong>UPDATE :</strong> </p>
  
  <p>I have now changed from using <code>android.app.Fragment</code> to <code>android.support.v4.app.Fragment</code> (i.e. from native fragments to support fragments) and the app is now performing as expected, with the replacement handler code running for all versions, and is stepping through the android source as expected. </p>
  
  <p>But the question remains : <strong>WHY</strong>? </p>
  
  <p><strong>Why</strong> is the 'native' <code>android.app.Fragment</code> implementation ****ed up? Looking back through earlier questions then this issue was being discussed back in September 2015. So <strong>why</strong> is it still an issue? And <strong>why</strong> should there be a difference in the implementation of support and native fragments post API 11? </p>