so i created a basic tic tac toe game for android using a table layout. Each row has 3 buttons, one row with a textview that says if X or O has won and the final row has the button. I am trying to add a "new game" button so if that button is pressed at any time, the game restarts.
here is the code in MainActivity.java:
here is the code for the button in the xml file:
when I press this button:
02-28 17:43:29.920: E/AndroidRuntime(6200): FATAL EXCEPTION: main
02-28 17:43:29.920: E/AndroidRuntime(6200): java.lang.ArrayIndexOutOfBoundsException
02-28 17:43:29.920: E/AndroidRuntime(6200): at com.example.tictactoekw.MainActivity$PlayOnClick.onClick(MainActivity.java:204)
02-28 17:43:29.920: E/AndroidRuntime(6200): at android.view.View.performClick(View.java:2585)
02-28 17:43:29.920: E/AndroidRuntime(6200): at android.view.View$PerformClick.run(View.java:9299)
02-28 17:43:29.920: E/AndroidRuntime(6200): at android.os.Handler.handleCallback(Handler.java:587)
02-28 17:43:29.920: E/AndroidRuntime(6200): at android.os.Handler.dispatchMessage(Handler.java:92)
02-28 17:43:29.920: E/AndroidRuntime(6200): at android.os.Looper.loop(Looper.java:130)
02-28 17:43:29.920: E/AndroidRuntime(6200): at android.app.ActivityThread.main(ActivityThread.java:3691)
02-28 17:43:29.920: E/AndroidRuntime(6200): at java.lang.reflect.Method.invokeNative(Native Method)
02-28 17:43:29.920: E/AndroidRuntime(6200): at java.lang.reflect.Method.invoke(Method.java:507)
02-28 17:43:29.920: E/AndroidRuntime(6200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
02-28 17:43:29.920: E/AndroidRuntime(6200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
02-28 17:43:29.920: E/AndroidRuntime(6200): at dalvik.system.NativeStart.main(Native Method)