mercredi 28 février 2018

Intent in condition doesn't work

i tried searching for this topic but i didn't find anything that would help me , so here i am asking this. i am a beginner so i don't understand a lot of terms and if you answer my question please try to use simple language so i could understand.

i have a condition in that compares a position in two array lists and if they aren't equal than it jumps to another activity

if (randomColors.get(i) != userColors.get(i)) {

               Intent i = new Intent( GameActivity.this, GameOverActivity.class);
                startActivity(i);
            }

and it displays an error in debugging that i cannot solve:

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gabie212.simonsays/com.gabie212.simonsays.GameOverActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference

please help, i am a beginner and i don't know what's wrong with my code because i have done exactly as they taught us in class... thanks in advance

Aucun commentaire:

Enregistrer un commentaire