null pointer exception
<p>i made Game1.java class in which there is a dialog box in which there are 3 option -plant 
     animal , insect.
     when i click on plant we get Null pointer exception at this below line </p>

<pre><code>    String[] plant_array = getResources().getStringArray(R.array.plant_category);



 my array.xml fine is here 

   &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;

&lt;string-array name="category"&gt;
    &lt;item&gt;Plant&lt;/item&gt;
    &lt;item&gt;Animal&lt;/item&gt;
    &lt;item&gt;Insect&lt;/item&gt;
&lt;/string-array&gt;
&lt;string-array name="plant_category"&gt;
    &lt;item&gt;VIKASKUMAR&lt;/item&gt;
    &lt;item&gt;SOHAN&lt;/item&gt;
    &lt;item&gt;NARENDRA&lt;/item&gt;
    &lt;item&gt;VISHAL&lt;/item&gt;
    &lt;item&gt;PRASHANT&lt;/item&gt;
    &lt;item&gt;VIJAYAPANDEY&lt;/item&gt;
    &lt;item&gt;SATYA&lt;/item&gt;
    &lt;item&gt;NARAYAN&lt;/item&gt;
    &lt;item&gt;CHOUBEY&lt;/item&gt;
    &lt;item&gt;PRABHA&lt;/item&gt;
&lt;/string-array&gt;
&lt;string-array name="animal_category"&gt;
    &lt;item&gt;VIKASKUMAR1&lt;/item&gt;
    &lt;item&gt;SOHAN1&lt;/item&gt;
    &lt;item&gt;NARENDRA1&lt;/item&gt;
    &lt;item&gt;VISHAL1&lt;/item&gt;
    &lt;item&gt;PRASHANT1&lt;/item&gt;
    &lt;item&gt;VIJAYAPANDEY1&lt;/item&gt;
    &lt;item&gt;SATYA1&lt;/item&gt;
    &lt;item&gt;NARAYAN1&lt;/item&gt;
    &lt;item&gt;CHOUBEY1&lt;/item&gt;
    &lt;item&gt;PRABHA1&lt;/item&gt;
&lt;/string-array&gt;
&lt;string-array name="insect_category"&gt;
    &lt;item&gt;VIKASKUMAR2&lt;/item&gt;
    &lt;item&gt;SOHAN2&lt;/item&gt;
    &lt;item&gt;NARENDRA2&lt;/item&gt;
    &lt;item&gt;VISHAL2&lt;/item&gt;
    &lt;item&gt;PRASHANT2&lt;/item&gt;
    &lt;item&gt;VIJAYAPANDEY2&lt;/item&gt;
    &lt;item&gt;SATYA2&lt;/item&gt;
    &lt;item&gt;NARAYAN2&lt;/item&gt;
    &lt;item&gt;CHOUBEY2&lt;/item&gt;
    &lt;item&gt;PRABHA2&lt;/item&gt;
&lt;/string-array&gt;
</code></pre>

<p></p>

<pre><code>    my Game1.java class is here


   public class Game1 extends Activity implements OnClickListener {

public static String key;
private int numwrongguesses;
private boolean flag = false;

private static String TAG = "game";
private Button abtn, bbtn, cbtn, dbtn, ebtn, fbtn, gbtn, hbtn, ibtn, jbtn,
        kbtn, lbtn, mbtn, nbtn, obtn, pbtn, qbtn, rbtn, sbtn, tbtn, ubtn,
        vbtn, wbtn, xbtn, ybtn, zbtn, btnHint;

private ImageView imageview;
private TextView mystword, hinttextView;
static final String KEY_CATEGORY = "com.shagunstudio.hangman.category";
private static final int CATEGORY_PLANT = 0;
private static final int CATEGORY_ANIMAL = 1;
private static final int CATEGORY_INSECT = 2;
protected static final int CONTINUE = -1;
String mysteryWord;
String hint;

private int cat;
int x;

// *************************************
   //HERE NULL POINTER EXCEPTION IS THERE i.e at plant_array[]

String[] plant_array = getResources().getStringArray(R.array.plant_category);
String[] plant_array_hint = getResources().getStringArray(R.array.plant_category_hint);

// ***********************************

String[] animal_array = getResources().getStringArray(R.array.animal_category);
String[] animal_array_hint = getResources().getStringArray(
        R.array.animal_category_hint);

// ***************************************************************

String[] insect_array = getResources().getStringArray(
        R.array.insect_category);
String[] insect_array_hint = getResources().getStringArray(
        R.array.insect_category_hint);

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.game);
    imageview = (ImageView) findViewById(R.id.hangmanimageview);
    abtn = (Button) findViewById(R.id.A_BUTTON);
    abtn.setOnClickListener(this);

    bbtn = (Button) findViewById(R.id.B_BUTTON);
    bbtn.setOnClickListener(this);

    cbtn = (Button) findViewById(R.id.C_BUTTON);
    cbtn.setOnClickListener(this);

    dbtn = (Button) findViewById(R.id.D_BUTTON);
    dbtn.setOnClickListener(this);

    ebtn = (Button) findViewById(R.id.E_BUTTON);
    ebtn.setOnClickListener(this);

    fbtn = (Button) findViewById(R.id.F_BUTTON);
    fbtn.setOnClickListener(this);

    gbtn = (Button) findViewById(R.id.G_BUTTON);
    gbtn.setOnClickListener(this);

    hbtn = (Button) findViewById(R.id.H_BUTTON);
    hbtn.setOnClickListener(this);

    ibtn = (Button) findViewById(R.id.I_BUTTON);
    ibtn.setOnClickListener(this);

    jbtn = (Button) findViewById(R.id.J_BUTTON);
    jbtn.setOnClickListener(this);

    kbtn = (Button) findViewById(R.id.K_BUTTON);
    kbtn.setOnClickListener(this);

    lbtn = (Button) findViewById(R.id.L_BUTTON);
    lbtn.setOnClickListener(this);

    mbtn = (Button) findViewById(R.id.M_BUTTON);
    mbtn.setOnClickListener(this);

    nbtn = (Button) findViewById(R.id.N_BUTTON);
    nbtn.setOnClickListener(this);

    obtn = (Button) findViewById(R.id.O_BUTTON);
    obtn.setOnClickListener(this);

    pbtn = (Button) findViewById(R.id.P_BUTTON);
    pbtn.setOnClickListener(this);

    qbtn = (Button) findViewById(R.id.Q_BUTTON);
    qbtn.setOnClickListener(this);

    rbtn = (Button) findViewById(R.id.R_BUTTON);
    rbtn.setOnClickListener(this);

    sbtn = (Button) findViewById(R.id.S_BUTTON);
    sbtn.setOnClickListener(this);

    tbtn = (Button) findViewById(R.id.T_BUTTON);
    tbtn.setOnClickListener(this);
    ubtn = (Button) findViewById(R.id.U_BUTTON);
    ubtn.setOnClickListener(this);

    vbtn = (Button) findViewById(R.id.V_BUTTON);
    vbtn.setOnClickListener(this);

    wbtn = (Button) findViewById(R.id.W_BUTTON);
    wbtn.setOnClickListener(this);

    xbtn = (Button) findViewById(R.id.X_BUTTON);
    xbtn.setOnClickListener(this);

    ybtn = (Button) findViewById(R.id.Y_BUTTON);
    ybtn.setOnClickListener(this);

    zbtn = (Button) findViewById(R.id.Z_BUTTON);
    zbtn.setOnClickListener(this);

    btnHint = (Button) findViewById(R.id.HINT_BUTTON);
    btnHint.setOnClickListener(this);

    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();
    int category = bundle.getInt(KEY_CATEGORY);
    // bundle.putInt(key, CATEGORY_PLANT);
    mysteryWord = getGameByCategory(category);

    Intent i = getIntent();
    Bundle b = i.getExtras();
    // int c = b.getInt(key);
    b.putInt(KEY_CATEGORY, CONTINUE);

    mystword = (TextView) findViewById(R.id.textviewhangman);
    hinttextView = (TextView) findViewById(R.id.hinttextView1);

    initMystWord();

}

@Override
protected void onPause() {
    super.onPause();

}

@Override
public void onClick(View v) {
    switch (v.getId()) {

    case R.id.A_BUTTON:
        flag = false;
        updateMystWord('A');
        break;
    case R.id.B_BUTTON:
        flag = false;
        updateMystWord('B');
        break;
    case R.id.C_BUTTON:
        flag = false;
        updateMystWord('C');
        break;
    case R.id.D_BUTTON:
        flag = false;
        updateMystWord('D');
        break;
    case R.id.E_BUTTON:
        flag = false;
        updateMystWord('E');
        break;
    case R.id.F_BUTTON:
        flag = false;
        updateMystWord('F');
        break;
    case R.id.G_BUTTON:
        flag = false;
        updateMystWord('G');
        break;
    case R.id.H_BUTTON:
        flag = false;
        updateMystWord('H');
        break;
    case R.id.I_BUTTON:
        flag = false;
        updateMystWord('I');
        break;
    case R.id.J_BUTTON:
        flag = false;
        updateMystWord('J');
        break;
    case R.id.K_BUTTON:
        flag = false;
        updateMystWord('K');
        break;
    case R.id.L_BUTTON:
        flag = false;
        updateMystWord('L');
        break;
    case R.id.M_BUTTON:
        flag = false;
        updateMystWord('M');
        break;
    case R.id.N_BUTTON:
        flag = false;
        updateMystWord('N');
        break;
    case R.id.O_BUTTON:
        flag = false;
        updateMystWord('O');
        break;
    case R.id.P_BUTTON:
        flag = false;
        updateMystWord('P');
        break;
    case R.id.Q_BUTTON:
        flag = false;
        updateMystWord('Q');
        break;
    case R.id.R_BUTTON:
        flag = false;
        updateMystWord('R');
        break;
    case R.id.S_BUTTON:
        flag = false;
        updateMystWord('S');
        break;
    case R.id.T_BUTTON:
        flag = false;
        updateMystWord('T');
        break;
    case R.id.U_BUTTON:
        flag = false;
        updateMystWord('U');
        break;
    case R.id.V_BUTTON:
        flag = false;
        updateMystWord('V');
        break;
    case R.id.W_BUTTON:
        flag = false;
        updateMystWord('W');
        break;
    case R.id.X_BUTTON:
        flag = false;
        updateMystWord('X');
        break;
    case R.id.Y_BUTTON:
        flag = false;
        updateMystWord('Y');
        break;
    case R.id.Z_BUTTON:
        flag = false;
        updateMystWord('Z');
        break;
    case R.id.HINT_BUTTON:
        flag = false;
        useHint();
        break;

    }

}

public String underscore() {
    StringBuffer buffer = new StringBuffer();

    Log.d(TAG, "nameof musteryword is =" + mysteryWord);
    for (int i = 0; i &lt; mysteryWord.length(); i++) {
        Log.d(TAG, "length of  musteryword is =" + mysteryWord.length());
        buffer.append("_ ");
    }
    return buffer.toString();
}

public void initMystWord() {
    mystword.setText(underscore());

}


private String getGameByCategory(int category) {
    String temp = null;
    switch (cat) {
    case CATEGORY_PLANT:
        Random random1 = new Random();
        x = random1.nextInt(5);
        mysteryWord = plant_array[x];
        //hint = plant_array_hint[x];
        temp = mysteryWord;
        break;
    case CATEGORY_ANIMAL:
        Random random2 = new Random();
        x = random2.nextInt(5);
        mysteryWord = animal_array[x];
        //hint = animal_array_hint[x];
        temp = mysteryWord;
        break;
    case CATEGORY_INSECT:
        Random random3 = new Random();
        x = random3.nextInt(5);
        mysteryWord = insect_array[x];
        //hint = insect_array_hint[x];
        temp = mysteryWord;
        break;
    }
    return temp;
}
</code></pre>

<p>}</p>

<p>we got error of null pointer exception and when we debug this program source not found show
 deguger is also not working ....please give me reply sir .. i will he highly thanks full to u</p>
