所以我正在使用ArthurHub / Android-Image-Cropper。我有一个关于让cropper弹出的问题。所以现在我有一个屏幕,我点击一个按钮,它带我到我的画廊,这是完美的。我可以去我的画廊等等。但是当我点击图库中的图像时,我没有把它带到剪裁编辑器,而是回到了我刚才的活动。这是我的代码
public class TestShareActivity extends AppCompatActivity {
private ImageButton imageButton;
private EditText mCaption;
private Button mShareBtn;
private static final int GALLERY_REQUEST = 1;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_share);
imageButton = (ImageButton) findViewById(R.id.profileImageButton);
mCaption = (EditText) findViewById(R.id.addCaption);
mShareBtn = (Button) findViewById(R.id.uploadBtn);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent galleryIntent = new Intent();
galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
galleryIntent.setType("image/*");
startActivityForResult(galleryIntent, GALLERY_REQUEST);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == GALLERY_REQUEST && requestCode == RESULT_OK){
CropImage.activity()
.setGuidelines(CropImageView.Guidelines.ON)
.start(this);
}
}
}
我的Manifest中也有这两个
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Logcat从我点击图片按钮进入我的画廊到我点击我想要的图片然后带我回到我的活动
Suspending all threads took: 16.868ms
Recording user engagement, ms: 2309
Activity paused, time: 11770529
Logging event (FE): _e, Bundle[{_o=auto, _et=2309, _sc=TestShareActivity, _si=3274131924141379636}]
showStatusIcon on inactive InputConnection
Inactivity, disconnecting from the service
Using measurement service
Connecting to remote service
Activity resumed, time: 11775975
Connected to remote service
Timeline: Activity_idle id: android.os.BinderProxy@39c720c9 time:5790129
Processing queued up service tasks: 1
Inactivity, disconnecting from the service