3
Android 앱의 버튼에 대한 onClick() 이벤트가 실행되지 않습니다. 이 버튼은 일련의 구성 활동에서 한 활동의 "다음"버튼입니다. 일련의 구성 작업을 처음 수행 할 때 onClick() 이벤트가 정상적으로 작동합니다. 그러나 앱에서 뒤로 돌아가서 (뒤로 버튼 사용) 다시 시작하면 이벤트가 실행되지 않습니다. 나는 next() 메소드에 중단 점을 넣음으로써 검증했다. 후속 액티비티를 호출하는 메소드 내 레이아웃Android 버튼 클릭 이벤트가 때때로 발생하지 않습니다.
버튼 XML :
<Button
android:id="@+id/gender_button_id"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:onClick="next"
android:text="@string/gender_button" />
활동 코드 :
여기 내 코드의 내부에 일부 로그 /에 println 문을 넣어
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gender);
}
public void next(View view)
{
Intent i = new Intent(this, WeightActivity.class);
startActivity(i);
}
버튼이 작동하지 않는 경우 로그 항목을 게시 할 수 있습니까? – jamesc
어디서 얻을 수 있습니까? – Vinnie
권자! Android 앱을 개발하려는 경우 로그 출력을 읽는 것이 중요합니다. 명령 줄에서 adb logcat을 실행하거나 코드 창 아래의 logcat 출력 탭에서 이클립스의 출력을 확인하십시오. – jamesc