This is my code. When I log uri, it can show the uri string, but
when I try to get the path from the intent the log message shows null.
What's wrong with it? Did I use something wrong?
File myFile = new
File(Environment.getExternalStorageDirectory(),
( System.currentTimeMillis()+ ".jpg"));
try {
FileOutputStream outStream = new
FileOutputStream(myFile);
outStream.write(data);
outStream.flush();
outStream.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
setResult(Activity.RESULT_CANCELED,null);
finish();
}
if(myFile.canRead()){
Intent intent = new Intent();
String uri = myFile.getAbsolutePath();
Log.i("lab5","uri:"+uri);
intent.putExtra(CameraPreview.IMAGE_FILE_NAME,Uri.parse(uri));
Log.i("lab5","file:"+intent.getExtras().getString(CameraPreview.IMAGE_FILE_NAME));
setResult(RESULT_OK, intent);
finish();
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en