【发布时间】:2018-08-27 16:47:54
【问题描述】:
我正在开发一项功能,用户可以在其中拍照并从图库中进行选择。这基本上是它开始并继续将图像保存在数据库中的地方。
private void showPictureDialog(){
AlertDialog.Builder pictureDialog = new AlertDialog.Builder(this);
pictureDialog.setTitle("Select Action");
String[] pictureDialogItems = {
"Select photo from gallery",
"Capture photo from camera" };
pictureDialog.setItems(pictureDialogItems,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case 0:
choosePhotoFromGallary();
break;
case 1:
takePhotoFromCamera();
break;
}
}
});
pictureDialog.show();
}
但是,我想让用户体验更好。我想跳过用户选择其中一个选项(从画廊或相机)的对话框,而是在相机意图中显示画廊。类似的东西:
我希望你明白我的意思。谢谢:)
【问题讨论】:
标签: android android-camera-intent