I have 2 activities. Both have surfaceview implemented. In the first one I have a variable called score1, and I want to pass the value from score1 to the second activity.
Every time I run the app it crash after it finish the first activity and tries to load the second. Before I write code to grab the intent extras in the second activity everything worked well.
My first activity has this intent:
Intent intent = new Intent (myContext, PunchItActivity.class);
intent.putExtra("score_var", score1);
myContext.startActivity(intent);
((Activity) myContext).finish();
And in my second activity the following code tries to grab the value of score1 variable:
Intent mIntent = ((Activity) myContext).getIntent();
int score1 = mIntent.getIntExtra("score_var", 0);
score1 *= molesWhacked + 10;
canvas.drawText("Score: " + Integer.toString(score1), 20, 160, blackPaint);
I cannot figure why the app is crashing every time activity one leaves the scene and activity two tries to render it's surfaceview and display the values from score1.