출처 : http://slogup.com/start-android/




액티비티 안에 onCreate 함수 안에 작성한다.



findViewById(R.id.button1).setOnClickListener(

        new View.OnClickListener() {

 

        @Override

        public void onClick(View v) {

               // TODO Auto-generated method stub

               Toast.makeText(MainActivity.this, "1 버튼 눌렀다!!!", Toast.LENGTH_SHORT).show();

 

               TextView tv = (TextView) findViewById(R.id.text);

               tv.setText("1 버튼 눌렀음!!");

        }

});

Posted by motolies
,