Can hook methods called by the system ever be passed in a null argument reference?
<p>While doing normal day-to-day Android development, is it safe to assume that hook methods called by the system will not pass in invalid references (ex.: <code>null</code>), or should I always be double-checking what arguments get passed in?</p>

<p>For example, can the method <code>onOptionsItemSelected(MenuItem)</code> ever have a null <code>MenuItem</code> reference passed into it?</p>

<p>The reason I ask is because I was working on the Notepad 1 tutorial, and the tutorial asked me to set up a switch statement like this ...</p>

<pre><code>@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case INSERT_ID:
            createNote();
            return true;
        default:
            break;
    }
    return super.onOptionsItemSelected(item);
}
</code></pre>

<p>I started wondering if I should be testing if <code>item</code> is <code>null</code> before making a <code>getItemId()</code> method call on it, or just trust the system to not ever pass me a <code>null</code>?</p>

<p>I don't want to make my code slower by doing null checks when I shouldn't be worried about that happening, etc.</p>
