This JAVA code in Android studio needs a reset button : In XML Button is: In java the way the program resets is as follo

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

This JAVA code in Android studio needs a reset button : In XML Button is: In java the way the program resets is as follo

Post by answerhappygod »

This JAVA code in Android studio needs a reset button:
In XML Button is:
In java the way the program resets is as follows but I need tomake it reset with button not this way.
// reset the gamepublic void gameReset(View view) {gameActive = true;activePlayer = 0;for (int i = 0; i < gameState.length; i++) {gameState = 2;}// remove all the images from the boxes inside the grid((ImageView)findViewById(R.id.imageView0)).setImageResource(0);((ImageView)findViewById(R.id.imageView1)).setImageResource(0);((ImageView)findViewById(R.id.imageView2)).setImageResource(0);((ImageView)findViewById(R.id.imageView3)).setImageResource(0);((ImageView)findViewById(R.id.imageView4)).setImageResource(0);((ImageView)findViewById(R.id.imageView5)).setImageResource(0);((ImageView)findViewById(R.id.imageView6)).setImageResource(0);((ImageView)findViewById(R.id.imageView7)).setImageResource(0);((ImageView)findViewById(R.id.imageView8)).setImageResource(0);
TextView status = findViewById(R.id.status);status.setText("X's Turn - Tap to play");}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply