카카오스토리 연동으로 사진을 찍어서 액티비티에 넣거나 갤러리에서 사진을 가져와서 액티비티에 뿌려줘야하는데
카메라 호출 하고 찍으면 이미지가 잘불려와지는데 갤러리에서 반응도 없습니다 ㅜ 이유가 먼지 모르겠네요 ..
소스코드 첨부 합니다 답변 부탁드리겠습니다 ㅠ
package com.example.story;
import java.io.FileNotFoundException;
import java.io.IOException;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;
import android.widget.Switch;
import com.example.layout.R;
public class Story extends Activity {
SoundPool mPool_2;
int btn_click;
static final int CALL_GALLERY=2;
static final int CALL_CAMERA=1;
ImageView Gallery,Cam,Turn_bt,Poto;
Intent Gallerty_Intent;
String mPath;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_story);
Poto= (ImageView)findViewById(R.id.POTO);
Gallery = (ImageView)findViewById(R.id.GALLERY);
Cam = (ImageView)findViewById(R.id.CAMARA);
Turn_bt = (ImageView)findViewById(R.id.turn_bt);
mPath = Environment.getExternalStorageDirectory().getAbsolutePath()+"/poto.jpg";
findViewById(R.id.GALLERY).setOnTouchListener(TouchListener);
findViewById(R.id.CAMARA).setOnTouchListener(TouchListener);
findViewById(R.id.turn_bt).setOnTouchListener(TouchListener);
mPool_2= new SoundPool(50,AudioManager.STREAM_MUSIC,0);
btn_click = mPool_2.load(this, R.raw.click_button, 1);
}
OnTouchListener TouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent;
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
switch(v.getId()){
case R.id.GALLERY:
Gallery.setImageResource(R.drawable.album_on);
break;
case R.id.CAMARA:
Cam.setImageResource(R.drawable.camera_on);
break;
case R.id.turn_bt:
Turn_bt.setImageResource(R.drawable.turn_bt_on);
break;
}
break;
case MotionEvent.ACTION_MOVE:
switch(v.getId()){
}
break;
case MotionEvent.ACTION_UP:
switch(v.getId())
{
case R.id.GALLERY:
mPool_2.play(btn_click, 1, 1, 0, 1, 1);
Gallery.setImageResource(R.drawable.album);
Gallerty_Intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(Gallerty_Intent, CALL_GALLERY);
break;
case R.id.CAMARA:
mPool_2.play(btn_click, 1, 1, 0, 1, 1);
Cam.setImageResource(R.drawable.camera);
intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, CALL_CAMERA);
break;
case R.id.turn_bt:
mPool_2.play(btn_click, 1, 1, 0, 1, 1);
Turn_bt.setImageResource(R.drawable.turn_bt);
finish();
break;
}
break;
}
return true;
}
};
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if(resultCode == RESULT_OK)
{
switch(requestCode)
{
case CALL_CAMERA:
Poto.setImageBitmap((Bitmap)data.getExtras().get("data"));
break;
case CALL_GALLERY:
try {
Poto.setImageBitmap(MediaStore.Images.Media.getBitmap(getContentResolver(), data.getData()));
} catch (Exception e) { ; }
break;
}
}
}
}