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

前端 未结 2 1751
无人及你
无人及你 2020-12-20 04:52

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:33

    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

    0 讨论(0)
  • 2020-12-20 05:45

    Try using the implementation shown here

    Specifically:

    Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
    
        public void onPictureTaken(byte[] imageData, Camera c) {
    
        }
    
    };
    
    0 讨论(0)
提交回复
热议问题