In my application users take photos with an Activity that implements
SurfaceHolder.Callback. The uri.toString() is then passed as an extra
to a subsequent Activity that displays the image. All fine, except for
in Android 1.6 the jpgs on the sdcard have a strange noise when
looking at them through mac finder or win explorer after mounting the
sdcard. The images have purple and yellow stripes on their upper half.
Fine on camera gallery.
Here's some (hopefully) relevant code.
The fact that it works on 1.5 and not 1.6 points to some underlying
problems..? Is this a known issue?
<code>
private OnClickListener shutterListener = new OnClickListener() {
public void onClick(View v) {
ImageCaptureCallback iccb = null;
filename = System.currentTimeMillis()+"";
ContentValues values = new ContentValues();
values.put(Media.TITLE, filename);
values.put(Media.DESCRIPTION, "my_photos");
uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI,
values);
try {
iccb = new ImageCaptureCallback( getContentResolver
().openOutputStream(uri));
} catch (FileNotFoundException ce) {Log.e(getClass
().getSimpleName(),ce.toString());}
//take the pic
camera.takePicture(mShutterCallback, mPictureCallbackRaw,
iccb);
}
.....
public class ImageCaptureCallback implements PictureCallback {
private OutputStream filoutputStream;
public ImageCaptureCallback(OutputStream filoutputStream) {
this.filoutputStream = filoutputStream;
}
public void onPictureTaken(byte[] data, Camera camera) {
try {
filoutputStream.write(data);
filoutputStream.flush();
filoutputStream.close();
} catch(Exception ex) {
ex.printStackTrace();
}
startNextActivity();
}
}
protected void startNextActivity() {
Log.d("CameraActivity","starting next activity...");
startActivity( new Intent(CameraActivity.this,
ImageAccepter.class).putExtra("pic", uri.toString()));
}
</code>
--
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