我正在尝试用相机拍照,然后将其转换为字节数组并传递给下一个活动。我不知道该怎么做。这是拍摄照片的活动的代码:
import java.io.ByteArrayOutputStream;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.provider.MediaStore;
import android.widget.ImageView;
public class TakePictureActivity extends Activity {
public final static int CAMERA_REQUEST = 1888;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TakePicture();
}
public void TakePicture() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(takePictureIntent, CAMERA_REQUEST);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// I don't know what to do here
}
}
我已经设置了下一个活动,因此它可以接收字节数组并对其进行解码,所以我需要的只是这个。