-1
에서 검색 할 수 있습니다. 데이터베이스에 이미지의 경로를 저장하는 방법과 imageView에 이미지를 표시하는 방법에 대해 알려줄 수있는 사람이 누구나 있습니다.이미지의 경로를 삽입하고 SQLite
에서 검색 할 수 있습니다. 데이터베이스에 이미지의 경로를 저장하는 방법과 imageView에 이미지를 표시하는 방법에 대해 알려줄 수있는 사람이 누구나 있습니다.이미지의 경로를 삽입하고 SQLite
이미지를 저장하고 이미지보기 이렇게 표시 할 수 있습니다.
String path = Environment.getExternalStorageDirectory().toString()+ "/Directoryname";
String imageName;
File mFolder = new File();
if (!mFolder.exists()) {
mFolder.mkdir(path);
}
imageName= "yourimagename.jpg";
//now you can store imagepath into database and imageto your sdcard so we can show image as per our requirement
File file = new File (mFolder, imageName);
if (file.exists()) file.delete();
Bitmap thumbnail = you can convert your image to bitmap and store into database.
try {
FileOutputStream out = new FileOutputStream(file);
thumbnail.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
//it will be store in your sdcard.
//for displaying image into imageview
File f = new File(path+"/"+imageName);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(f.getAbsolutePath(), options);
iv.setImageBitmap(bitmap);
혹시 문제가 있으면 알려주십시오.
검색 엔진은 귀하의 친구입니다. 아마도 "ImageView tutorial"또는 "Android SQLite example"을 검색 한 적이 있습니까? – MarsAtomic