android spinner shows unwanted keyboard
<p>I have an activity in which there are several buttons and a spinner containing a list of preset values. Unfortunately, if the user accidentally or mistakenly taps the spinner, the soft keyboard appears. Why? There is nowhere on the screen that expects typed input from the user.</p>

<p>More to the point, how can I prevent this from happening? After some research, I tried adding the following code:</p>

<pre><code> m_TricksPicker.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        InputMethodManager imm=(InputMethodManager)getApplicationContext().
            getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);

        imm.hideSoftInputFromWindow(getParent().getCurrentFocus().getWindowToken(), 0);

        return false;
    }
}) ;
</code></pre>

<p>Unfortunately, this throws a null pointer exception. Any other suggestions how to stop the keyboard from appearing (and I'd really like to understand why the system thinks it's necessary in the first place, when no user input is required)?</p>