When using the Camera app in Android, how can I return the whole image instead of just the thumbnail?

删除回忆录丶 提交于 2019-11-29 12:49:01

Try using the implementation shown here

Specifically:

Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {

    public void onPictureTaken(byte[] imageData, Camera c) {

    }

};
jp36

You could also change the intent you're using.

//in your buttonListener
ContentValues values = new ContentValues();
imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
//create new Intent
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);

try{
    startActivityForResult(i, ACTIVITY_GET_IMAGE);
}
catch(Exception ex){
    Log.v("BRE", ex.toString());
}
//in your activity
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if(requestCode == ACTIVITY_GET_IMAGE){
        if(resultCode == RESULT_OK){
            try{String uri = data.getData().toString()}
            catch(NullPointerException e){//do something}
        }
    }
}

This will return a uri which you can then use to access the full resolution image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!