안드로이드 개발 질문/답변
(글 수 45,052)
--소스--
public static final int REQ_IMAGE_SELECT = 0;
public static final int REQ_CAMERA_SELECT = 0;
protected static final int REQ_CODE_PICK_PICTURE = 0;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.actedit);
Button btnOK=(Button)findViewById(R.id.ok);
btnOK.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent,1);
onActivityResult(REQ_CODE_PICK_PICTURE, REQ_CODE_PICK_PICTURE, cameraIntent);
}
});
Button btnCancel=(Button)findViewById(R.id.cancel);
btnCancel.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(android.provider.MediaStore.Images.Media.CONTENT_TYPE);
intent.setData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, REQ_CODE_PICK_PICTURE);
onActivityResult(REQ_CODE_PICK_PICTURE, REQ_CODE_PICK_PICTURE,intent);
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
String a;
a= data.toString();
if(resultCode!=0 && requestCode==1&&!data.equals(null)){
if(resultCode!=0){
if(requestCode==1&&!data.equals(null)){
try{
ImageView img = (ImageView)findViewById(R.id.imageView1);
img.setImageBitmap((Bitmap)data.getExtras().get("data"));
img.setScaleType(ImageView.ScaleType.FIT_XY);
Toast.makeText(ActEdit.this, a, Toast.LENGTH_LONG).show();//intent 값 확인을 위한 토스트
} catch(Exception e){
return;
}
}
}
}
else{
if (requestCode == REQ_CODE_PICK_PICTURE) {
if (resultCode == Activity.RESULT_OK) {
if(data !=null){
ImageView img = (ImageView)findViewById(R.id.imageView2);
img.setImageBitmap((Bitmap)data.getParcelableExtra("data"));//썸메일로 불르기
img.setScaleType(ImageView.ScaleType.FIT_XY);
//img.setImageURI(data.getData());//풀이미지 불르기
Toast.makeText(ActEdit.this, a, Toast.LENGTH_LONG).show();
}
}
}
}
}
}
-------
여기까지가 소스입니다.
저의 질문은
카메라 찍은후 보이는 화면을 썸메일로 보여지는대 사진첩에서 가지고 오는 사진을 부를 때
토스트 하여 인텐트 값은 받아오지만 비트맵 으로 전환된 사진은 받아오지 못합니다 원본 이미지로
불러오면 바로 불러와 집니다 어디 부분을 수정해야사진첩에서 내가 원하는 사진을 썸메일로 불러올수 있을까요?
인데요 답변 좀 부탁 드릴게요 ㅠㅠ