안녕하세요.
완전 초보가 프로그램 짜다가 모르는게 있어 질문드립니다...
꼭 도와주세요... ㅠ.ㅜ
package com.company.test;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.Toast;
public class test extends Activity implements OnClickListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageButton img_Game01 = (ImageButton)findViewById(R.id.Game01);
img_Game01.setOnClickListener(this);
ImageButton img_Game02 = (ImageButton)findViewById(R.id.Game02);
img_Game02.setOnClickListener(this);
ImageButton img_Game03 = (ImageButton)findViewById(R.id.Game03);
img_Game03.setOnClickListener(this);
ImageButton img_Game04 = (ImageButton)findViewById(R.id.Game04);
img_Game04.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v.getId() == R.id.Game01){
Intent i = new Intent(this, Game01.class);
startActivityForResult(i, 1);
} else if(v.getId() == R.id.Game02){
Toast.makeText(test.this, "게임2", Toast.LENGTH_SHORT).show();
} else if(v.getId() == R.id.Game03){
Toast.makeText(test.this, "게임3", Toast.LENGTH_SHORT).show();
} else if(v.getId() == R.id.Game04){
Toast.makeText(test.this, "게임4", Toast.LENGTH_SHORT).show();
}
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
//Bundle extras = intent.getExtras();
switch(requestCode){
case 1:
Toast.makeText(test.this, "게임1", Toast.LENGTH_SHORT).show();
break;
}
}
}
위에 소스가요... 화면에서 이미지버튼 4개 만들고 버튼 클릭하면 새로운 액티비티를 호출하는 건데요...
실행하면 에러가 나요... ㅠ.ㅜ 뭐가 빠진걸까요???
안드로이드 너무 어려워요... ㅠ.ㅜ



