i new in android i am working on game tic tac toe but when i run it on emulator it says tic tac toe has stop working. i don't know whats going wrong. my code has no errors.
This is my mainactivity class code:
public class MainActivity extends AppCompatActivity {
Button btn_one;
Button btn_two;
int myVeriable=0,player1Score=0,player2Score=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn_one= (Button) findViewById(R.id.one);
btn_two= (Button) findViewById(R.id.two);
}
private void one_Click(View myView)
{
if(!b1)
{
if(meraVeriable%2==0)
{
btn_one.setText("O");
}
else
{
btn_one.setText("X");
}
}
}
private void two_Click(View myView)
{
if(!b2)
{
if(meraVeriable%2==0)
{
btn_two.setText("O");
}
else
{
btn_two.setText("X");
}
}
}
}
This is my xml code:
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/one"
android:textStyle="bold"
android:textColor="#fedc00"
android:onClick="one_Click"/>
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/two"
android:textStyle="bold"
android:textColor="#fedc00"
android:onClick="two_Click" />
this is log cat screen shot: