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

前端 未结 2 673
旧巷少年郎
旧巷少年郎 2020-12-20 05:27

I am making an app that sends a picture taken from the Camera app however the image it returns seems to be only a thumbnail how can I get it to turn the whole image?

2条回答
  •  失恋的感觉
    2020-12-20 05:46

    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

提交回复
热议问题