我将相机拍摄的图像的路径保存到 sqlite DB 中,如下所示:retrievePath() 方法是从数据库中检索保存的路径。
getImageUri(imgPath)
方法是将文件路径转换为uri。
OnClickListener btn_TakePictureListener = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File imgPath = retrievePath();
intent.putExtra(MediaStore.EXTRA_OUTPUT, getImageUri(imgPath));
startActivityForResult(intent, RequestCode);
}
};
private File retrievePath() {
int []x = imgOpHlpr.getIDs();
String s = imgOpHlpr.getImg_Path(x.length);
File file = new File(s);
Toast.makeText(getApplicationContext(), "retrieved path "+s.toString(),
Toast.LENGTH_LONG).show();
return file;
}
private Uri getImageUri(File path) {
Uri imgFileUri = Uri.fromFile(path);
return imgFileUri;
}
我现在想知道的是:从数据库中检索路径后,如何在 imageView 中显示该路径的内容。换句话说,当然图像的路径包含数据,我想在ImageView
.
怎么做?