Simple quiz....java.lang.NullPointerExeption error
<p>I'm trying to make a simple quiz with JSON using .txt file with questions and answers. It's not so simple for me. I have only 23 questions in my trial txt file. Anyway, i'm getting error: Caused by: java.lang.NullPointerExeption on line 65 of the Kviz class, that's right bellow "newGame();" . Here the code for the Kviz.java:</p>

<pre><code>package rs.androidaplikacijekvizopstekulture;

import java.io.IOException;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;

public class Kviz extends Activity implements View.OnClickListener{

    Button bIzlazIzKviza, bOdgovor1, bOdgovor2, bOdgovor3, bOdgovor4;
    TextView question;
    kvizData kvizData = null;
    boolean mWait = false;

    private void newGame(){
        try {
        if(this.kvizData == null)
            this.kvizData = new kvizData();
            this.kvizData.randomQuestion();
            this.question.setText(this.kvizData.getQuestion());
            this.bOdgovor1.setText(this.kvizData.getAnswer()[0]);
            this.bOdgovor2.setText(this.kvizData.getAnswer()[1]);
            this.bOdgovor3.setText(this.kvizData.getAnswer()[2]);
            this.bOdgovor4.setText(this.kvizData.getAnswer()[3]);
            this.bOdgovor1.setEnabled(true);
            this.bOdgovor2.setEnabled(true);
            this.bOdgovor3.setEnabled(true);
            this.bOdgovor4.setEnabled(true);
            return;
        } catch (IOException localIOException) {
            while(true)
            localIOException.printStackTrace();
        }
    }


    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.kviz);

        bIzlazIzKviza = (Button) findViewById(R.id.bIzlazIzKviza);
        question = (TextView) findViewById(R.id.tvPitanje);
        bOdgovor1 = (Button) findViewById(R.id.bOdgovor1);
        bOdgovor2 = (Button) findViewById(R.id.bOdgovor2);
        bOdgovor3 = (Button) findViewById(R.id.bOdgovor3);
        bOdgovor4 = (Button) findViewById(R.id.bOdgovor4);
        bOdgovor1.setOnClickListener(this);
        bOdgovor2.setOnClickListener(this);
        bOdgovor3.setOnClickListener(this);
        bOdgovor4.setOnClickListener(this);
            newGame();


        bIzlazIzKviza.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                finish();

            }
        });

    }


    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
    }

    public void onClick(View v) {
        // TODO Auto-generated method stub

    }
}
</code></pre>

<p>and here's the code for kvizData.java:</p>

<pre><code>package rs.androidaplikacijekvizopstekulture;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;

public class kvizData {
     static String resourceFile;
      static int size = -1;
      String[] answer = new String[4];
      String question;
      int right;

      public kvizData()
      {
        if (size &lt; 0);
        try
        {
          loadResource("/rs/androidaplikacije/kvizopstekulture/data/pitanja.txt");
          return;
        }
        catch (IOException localIOException)
        {
          while (true)
            localIOException.printStackTrace();
        }
      }

      private void loadResource(String paramString)
        throws IOException
      {
        resourceFile = paramString;
        InputStream localInputStream = getClass().getResourceAsStream(paramString);
        BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(localInputStream, "UTF-8"));
        for (size = 0; ; size = 1 + size)
        {
          String str;
          do
          {
            str = localBufferedReader.readLine();
            if (str == null)
            {
              localInputStream.close();
              return;
            }
          }
          while ((str == null) || (str.trim().length() &lt;= 0));
        }
      }

      public static void main(String[] paramArrayOfString)
        throws IOException
      {
        kvizData localkvizData = new kvizData();
        localkvizData.loadResource("/rs/kvizopstekulture/data/pitanja.txt");
        for (int i = 0; ; i++)
        {
          if (i &gt;= 23)
            return;
          localkvizData.randomQuestion();
          System.out.println();
        }
      }

      public String[] getAnswer()
      {
        return this.answer;
      }

      public String getQuestion()
      {
        return this.question;
      }

      public int getRight()
      {
        return this.right;
      }

      public void randomQuestion()
        throws IOException
      {
        int i = (int)(Math.random() * size);
        BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(resourceFile), "UTF-8"));
        int j = 0;
        while (true)
        {
          String str = localBufferedReader.readLine();
          if (str == null)
            return;
          if ((str != null) &amp;&amp; (str.trim().length() &gt; 0))
          {
            j++;
            if (j == i)
            {
              System.out.println(str);
              JsonArray localJsonArray = new JsonParser().parse(str).getAsJsonArray();
              this.question = localJsonArray.get(0).getAsString();
              System.out.println(this.question);
              this.right = localJsonArray.get(1).getAsInt();
              this.answer[0] = localJsonArray.get(2).getAsString();
              this.answer[1] = localJsonArray.get(3).getAsString();
              this.answer[2] = localJsonArray.get(4).getAsString();
              this.answer[3] = localJsonArray.get(5).getAsString();
            }
          }
        }
      }

      public void setAnswer(String[] paramArrayOfString)
      {
        this.answer = paramArrayOfString;
      }

      public void setQuestion(String paramString)
      {
        this.question = paramString;
      }

      public void setRigth(int paramInt)
      {
        this.right = paramInt;
      }
}
</code></pre>
