###前提・実現したいこと
AndroidStudioでカウントアプリを作っているのですがエラーがでて-10カウントのボタンを押すとアプリが強制終了します。
###発生している問題・エラーメッセージ
public class MainActivity extends AppCompatActivity { TextView textView; TextView textView2; int count; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView= (TextView)findViewById(R.id.textView); textView2=(TextView)findViewById(R.id.textView2); } public void add(View v){ count=count+1; textView.setText(count+"回ボタンが押されました!"); } public void minus(View v){ count=count-1; textView.setText(count+"回ボタンが押されました!"); } public void add2(View v){ count=count+10; textView2.setText(count+"回ボタンが押されました!"); } public void minus2(View v){ count=count-10; textView2.setText(count+"回ボタンが押されました!"); } }
エラーの詳細も開示されると回答が出来ると思います。