以下代码是从设备中挑选图片。如何从device中选择pdf以及如何在图像视图中显示pdf?
bt_gall .setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
// Show only images, no videos or anything else
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
// Always show the chooser (if there are multiple options available)
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
alertDialog.dismiss();
}
});
答案 0 :(得分:1)
选择pdf试试这个
Intent intent = new Intent();
intent.setType("application/pdf");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select PDF"), 1);
要将Pdf设置为图像,您需要创建pdf缩略图
创建缩略图检查,
https://stackoverflow.com/a/38829523/3416642
希望这会对你有所帮助。