title: What is the correct way to get layout inflater in Android?
body: <p>There is a way to get layoutInflater:</p>
  
  <pre><code>LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  </code></pre>
  
  <p>and another way is:</p>
  
  <pre><code>LayoutInflater inflater = LayoutInflater.from(context);
  </code></pre>
  
  <p>a third one (when I am in an Activity) is:</p>
  
  <pre><code>LayoutInflater inflater = getLayoutInflater();
  </code></pre>
  
  <p>So what is the difference between them?</p>
  
  <p>Note that when I sent the third inflater to my adapter, my application worked. But when I sent the context and created the inflater via the second way, it didn't!</p>