Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 26th, 2012  |  syntax: None  |  size: 0.93 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. issues to save and retrive the image in android?
  2. try {
  3.                 toDisk.compress(Bitmap.CompressFormat.JPEG, 100, new FileOutputStream(new File("/mnt/sdcard/image00"+saveimageid+".jpg")));
  4.                 saveimageid++;
  5.             } catch (FileNotFoundException e) {
  6.                 // TODO Auto-generated catch block
  7.                 e.printStackTrace();
  8.             }
  9.        
  10. File imgFile = new  File("/mnt/sdcard/image001.jpg");
  11. if(imgFile.exists()){
  12.  
  13.     Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
  14.  
  15.     ImageView myImage = (ImageView) findViewById(R.id.ImageView01);
  16.     myImage.setImageBitmap(myBitmap);
  17.        
  18. new File(String.format("/mnt/sdcard/image%03d.jpg", saveimageId))
  19.        
  20. File dir = new File("/mnt/sdcard/");
  21. File[] images = dir.listFiles(new FilenameFilter() {
  22.      @Override
  23.      public boolean accept(final File dir, final String filename) {
  24.          return filename.matches("image[0-9]+\.jpg");
  25.      }
  26. });