저는 모바일 프로그래밍에 익숙하지 않고 지금은 약간의 어려움을 겪고 있습니다. DialogPrefence
으로 비밀번호를 설정하기 위해 무언가를 쓰려고합니다. 제 질문은 대화 상자에서 OK
에있는 OnClick 이벤트를 어떻게 받습니까?OnClick에서 작동하도록 DialogPreference POSITIVE_BUTTON을 얻는 방법은 무엇입니까?
package com.kontrol.app;
import android.content.Context;
import android.content.DialogInterface;
import android.preference.DialogPreference;
import android.util.AttributeSet;
public class SS1_Senha extends DialogPreference implements DialogInterface.OnClickListener{
public SS1_Senha(Context context, AttributeSet attrs) {
super(context, attrs);
setPersistent(false);
setDialogLayoutResource(R.layout.ss1_senha);
setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Action after OK
}
});
}
}
감사처럼 많은 사용자 정의
DialogPreference
클래스를 작성DialogInterface.OnClickListener
를 구현하고 각 버튼의
OnClick
이벤트를 처리 할 필요가! 그것은 매력처럼 작동합니다! –setNegativeButtonText ("CANCEL"); – Pawel