Page 129 - 3-2
P. 129
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
// 메뉴버튼이 처음 눌러졌을 때 실행되는 콜백메서드
// 메뉴버튼을 눌렀을 때 보여줄 menu 에 대해서 정의
getMenuInflater().inflate(R.menu.main_menu, menu);
Log.d("test", "onCreateOptionsMenu - 최초 메뉴키를 눌렀을 때 호출됨"); // 디버깅
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
Log.d("test", "onPrepareOptionsMenu - 옵션메뉴가 " + " 화면에 보여질때 마다 호출됨");
menu.getItem(0).setEnabled(false);
menu.getItem(1).setEnabled(true);
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_index) {
Intent index = new Intent(getApplicationContext(), MainActivity_tag.class);
startActivity(index);
return true;
} else if (item.getItemId() == R.id.menu_set) {
Intent set = new Intent(getApplicationContext(), MainActivity_set.class);
startActivity(set);
return true;
}
return super.onOptionsItemSelected(item);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void onbtn_TagClicked(View view) {
new SigninActivity_purchase().execute("0");
Log.d(" 여긴가", "9.5_purcharse, 버튼 누름");
purchase_btn.setBackgroundColor(Color.BLUE);
purchase_btn.setTextColor(Color.WHITE);
}
class SigninActivity_purchase extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String[] arg0) {
- 129 -