오늘은 첫 번째 안드로이드 앱을 만들기 시작했습니다. 자바로 작업하곤 했었지만 안드로이드 앱에서 어떻게 해야할지 모릅니다. 이것은 간단한 계산기입니다. 사용자가 잘못된 숫자를 입력하면 메시지 대화 상자를 표시하려고합니다.안드로이드에서 메시지 대화 표시하기
public void calculate(View v) {
EditText theNumber = (EditText) findViewById(R.id.number);
int num;
try {
num = Integer.parseInt(theNumber.getText().toString());
} catch (NumberFormatException e) {
//missing code here
}
}
자바 SE에서 난 그냥이 할 거라고 :
public void calculate(View v) {
EditText theNumber = (EditText) findViewById(R.id.number);
int num;
try {
num = Integer.parseInt(theNumber.getText().toString());
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog("Invalid input");
}
}
나는 것을 어떻게 할 수있는 안드로이드에
여기 내 코드입니까?
JOptionPane을 사용할 수 없다는 것을 알고 있지만, 무엇을 사용할 수 있는지 알지 못했습니다. 이것은 안드로이드 애플 리케이션을 프로그래밍 처음입니다. 감사 – SaintLike