Null PointerException in spinner in android
<p>I am working in Android. I want to design a spinner of song categories. </p>

<p>This is my code:</p>

<pre><code>public Spinner spinner_category_forSong;

String[] arr_Category={"Select","sad","dj","rock"};

ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(
    this,android.R.layout.simple_spinner_item,arr_Category);

spinner_category_forSong = (Spinner)findViewById(R.id.Spinner_category_forUpload);    
spinner_category_forSong.setPrompt("Music Category :");
spinner_category_forSong.setAdapter(adapter);
</code></pre>

<p>But whenever I run my project, a null pointer exception is created in       <code>spinner_category_forSong.setPrompt("Music Category :");</code> and <code>spinner_category_forSong.setAdapter(adapter);</code>.</p>

<p>Please tell me what mistake I have made in this code.</p>
