Crop saved Image using com.android.camera.action.CROP on android

前端 未结 4 1633
温柔的废话
温柔的废话 2020-12-21 09:27

I have reads many question about this, but I still failed using this code... maybe anyone can corect my code... I want to crop an image from file that i know the location us

4条回答
  •  生来不讨喜
    2020-12-21 09:47

    Then start the activity, use this

    startActivityForResult(intent, 1);  
    

    then use the following to get croped image

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            if (resultCode != RESULT_OK)return;
    
            switch (requestCode) {
    
                case 1:         
                    Bundle extras = data.getExtras();
                    if (extras != null) {               
                        photo = extras.getParcelable("data");               
    
    
                            tampilan.setBitmap(photo);
    break;
    }
    }
    }
    

提交回复
热议问题