개발 중 에러가 발생했는데 어떻게 처리를 해야할지 모르겠어서 질문합니다. 간단한 게임을 개발하는 중인데 첫 화면에서 게임 화면으로 넘어가는 버튼 (Game Start)를 눌렀더니 이런 에러가 발생하네요. 어떻게 해야지 화면이 넘어갈까요.? 애뮬레이터도 앱이 자꾸 꺼지구요.. 매니페스트에는 등록을 한 상태 입니다.
에러 : E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.pc1.myapplication, PID: 3363 java.lang.IllegalStateException: Could not find method GameStart(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'StartButton'
코드 (메인 자바)
public void GameStart(View view){
Intent intent = new Intent(getApplication(), GameActivity.class);
startActivity(intent);
}
(메인 액티비티)
(메인 액티비티)
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GAME START"
android:textSize="39dp"
android:layout_marginBottom="14dp"
android:id="@+id/StartButton"
android:onClick="GameStart"
android:layout_above="@+id/SaveButton"
android:layout_centerHorizontal="true" />