java.lang.RuntimeException: Unable to start activity ComponentInfo java.lang.NullPointerException
<p>I'm building an Android app to quiz people on subjects, the backend is written in Java and it reads and parses CSV file (hard coded URL) , and the front end is my Android app. </p>

<p>Here is my error: </p>

<pre><code>05-08 01:19:00.792: E/AndroidRuntime(790): java.lang.RuntimeException: Unable to start activity ComponentInfo{cs314.adamnick.p4/cs314.adamnick.p4.QuizTakerGUI}: java.lang.NullPointerException
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.os.Looper.loop(Looper.java:123)
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.app.ActivityThread.main(ActivityThread.java:4627)
05-08 01:19:00.792: E/AndroidRuntime(790):  at java.lang.reflect.Method.invokeNative(Native Method)
05-08 01:19:00.792: E/AndroidRuntime(790):  at java.lang.reflect.Method.invoke(Method.java:521)
05-08 01:19:00.792: E/AndroidRuntime(790):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-08 01:19:00.792: E/AndroidRuntime(790):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-08 01:19:00.792: E/AndroidRuntime(790):  at dalvik.system.NativeStart.main(Native Method)
05-08 01:19:00.792: E/AndroidRuntime(790): Caused by: java.lang.NullPointerException
05-08 01:19:00.792: E/AndroidRuntime(790):  at wharehouse.QuizAndroidGUI.&lt;init&gt;(QuizAndroidGUI.java:36)
05-08 01:19:00.792: E/AndroidRuntime(790):  at cs314.adamnick.p4.QuizTakerGUI.onCreate(QuizTakerGUI.java:38)
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-08 01:19:00.792: E/AndroidRuntime(790):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-08 01:19:00.792: E/AndroidRuntime(790):  ... 11 more
</code></pre>

<p>Which causes my program to crash. </p>

<p>Here's my class: </p>

<pre><code>public class QuizTakerGUI extends Activity {

    private RadioButton answer1;
    private RadioButton answer2;
    private RadioButton answer3;
    private RadioButton answer4;

    private Button submit; 
    private Button previous; 
    private Button next; 
    private Button finish; 

    private TextView questionArea; 

    private QuizAndroidGUI dataWharehouse;
    private QuizQuestion currentQuestion;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_quiz_taker);

        dataWharehouse = new QuizAndroidGUI(this);

        answer1 = (RadioButton) findViewById(R.id.answer1);
        answer2 = (RadioButton) findViewById(R.id.answer2);
        answer3 = (RadioButton) findViewById(R.id.answer3);
        answer4 = (RadioButton) findViewById(R.id.answer4);

        questionArea = (TextView) findViewById(R.id.quizQuestion); 


        submit = (Button) findViewById(R.id.submitAnswer);
        previous = (Button) findViewById(R.id.prev);
        next = (Button) findViewById(R.id.next);
        finish = (Button) findViewById(R.id.finish);

        submit.setOnClickListener(submitHandler);
        previous.setOnClickListener(previousHandler);
        next.setOnClickListener(nextHandler);
        finish.setOnClickListener(finishHandler);
    }
</code></pre>

<p>Here's my datawhare house class:</p>

<pre><code>public QuizAndroidGUI(QuizTakerGUI app){
    URL path = ClassLoader.getSystemResource("questions.csv");
    this.androidApplication = app; 
    NUMBERofQUIZES = 10; 
    // since we implement quiz ui we pass in the current program 
    quizTaker = new QuizTaker(this);
    try {
        // passing in the csv file hard coded 
        parser = new QuestionParser(new File(path.toURI()));
    } catch (FileNotFoundException e) {
        parser = null; 
        e.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    quizTaker.startAndDisplayQuiz("Android Quiz", this.NUMBERofQUIZES, this.parser);
}
</code></pre>

<p>I think the issue maybe caused because the parser is getting set to null. </p>
