안녕하세요

안드로이드 로 앱스 개발중인 학생입니다 ㅎㅎ

처음 접하다보니 모르는 부분이 너무 많아서 간단할거 같은데 어떻게 코딩을 해야할지 몰라 질문 올립니다.

간단하게 설명 드리자면

int a = 20;
이라고 주어 준뒤

edittext 에 값을 입력하여 버튼을 눌렀을때

result = a - (edittext의 입력한 값)  출력 해보이고 싶습니다.

예를 들어

public class sub extends Activity {
 int a = 20;
 
 int result;
 
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  Button btn = (Button)findViewById(R.id.result_btn);
  btn.setOnClickListener(new Button.OnClickListener() {
   public void onClick(View v) {
    
    result = a -(R.id.result_btn);
    TextView text1 = (TextView)findViewById(R.id.text);
    text1.setText("연산 결과 = " + result);
    
   }
  });  
 }
 

}

이런식으로 코딩햇더니 버튼을 클릭햇을때 sorry라는 글과 경고메시지가 뜨더라구요 ㅎ;

초보자 이다보니 .입력받은값을 임의의 값과 빼는 것도 잘 안되서 질문올립니다.