Skip to content

Instantly share code, notes, and snippets.

@godjooyoung
Created June 9, 2020 02:31
Show Gist options
  • Save godjooyoung/314434cb59156ff68bff5fd1a0cb78e8 to your computer and use it in GitHub Desktop.
Save godjooyoung/314434cb59156ff68bff5fd1a0cb78e8 to your computer and use it in GitHub Desktop.
로그인 버튼에 클릭 이벤트 걸었다. Tost는 밑에 작게 잠깐 올라오는거 로그창에 sysout으로 입력도 되게함. 로그인 버튼의 버튼 id는 button임
package com.example.hello;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "버튼 클릭됨", Toast.LENGTH_LONG);
System.out.println("버튼클릭됬음니다. 런창에 이 메세지가 뜹니다.");
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment