package com.example.s01;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity implements View.OnClickListener{
Button btn_noname,btn_class,btn_main;
@Override
protected void onCreate(Bundle savedInstanceState) {
// 처음 시작시 한번 호출된다.
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); // 말그대로 보여준다.
btn_class = (Button)findViewById(R.id.btn_class);
btn_noname = (Button)findViewById(R.id.btn_noname);
btn_main = (Button)findViewById(R.id.btn_main);
btn_class.setOnClickListener(new ButtonClick());
btn_noname.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, "무명메서드", Toast.LENGTH_LONG).show();
}
});
btn_main.setOnClickListener(this);
}
//onCreate
class ButtonClick implements View.OnClickListener {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, "내부클래스", Toast.LENGTH_LONG).show();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, "액", Toast.LENGTH_LONG).show();
}
}
'이전것 > 개발' 카테고리의 다른 글
android -> binary search game (0) | 2016.07.07 |
---|---|
android -> Event Case (0) | 2016.07.07 |
https://play-entry.org/tt#!/basic/solve (0) | 2016.07.06 |
php -> cross array (0) | 2016.07.06 |
php -> two-dimensional arrays (0) | 2016.07.06 |