title: Android Studio: Unboxing of 'xxx' may produce 'java.lang.NullPointerException'
body: <p>I'm following the Android book example: </p>
  
  <pre><code>//Get the drink from the intent
  int drinkIdd = (Integer)getIntent().getExtras().get(EXTRA_DRINKID);
  Drink drink = Drink.drinks[drinkIdd];
  </code></pre>
  
  <p>And this project could be ran in Android Studio but with a yellow warning on line:</p>
  
  <pre><code>int drinkIdd = (Integer)getIntent().getExtras().get(EXTRA_DRINKID);
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>info: Unboxing of '(Integer)getIntent().getExtras().get(EXTRA_DRINKID)' may produce 'java.lang.NullPointerException'
  </code></pre>
  
  <p>From my understanding, <code>get(EXTRA_DRINKID)</code> return an Object, and (Integer) converts it to int type to meet with <code>int drinkIdd</code>.</p>
  
  <ul>
  <li>Could you tell me what this info means exactly, your answer will be appreciated for a beginner.</li>
  <li><p>And could I write upper line like this? Using <strong>( )</strong> to wrap getIntent().getExtras().get() as a whole one since it finally return an object, and then convert it to int.</p>
  
  <pre><code>int drinkIdd = (Integer)(getIntent().getExtras().get(EXTRA_DRINKID));
  </code></pre></li>
  </ul>