> 1. Thumbnail display. When I go back to the first screen of the > application, I want to show an ImageView of the jpeg that the user has > just taken. Current code, which doesn't work because it's not looking > in the SD card: > > bmp = BitmapFactory.decodeStream(openFileInput("photo.jpg")); > iv.setImageBitmap(bmp); > > This gives the error: "java.IO.FileNotFoundException: /data/data/ > com.android.filename/files/photo.jpg". How can I ask BitmapFactory to > look in the SD card for the jpeg?
Use regular Java I/O to open the stream, rather than openFileInput(). Environment.getExternalStorageDirectory() will return you a File pointing to the SD card, which you can use as the basis for building your path. > 2. Uploading the jpeg - I would like to convert the jpeg to a byte[] > array, to upload it as part of a FilePart. Again, how can I retrieve > the jpeg from the SD card to do this? Use the same stream as above, and read it in: http://www.exampledepot.com/egs/java.io/File2ByteArray.html -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---