vendredi 17 avril 2015

how to get capture without storing it - Android

I have the following code and I m trying to retrieve the image I captured without having to store it to the external storage before doing so. Is there a way to retrieve the image without storing it anywhere first?



private static final int CAMERA_REQUEST = 1;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

imageView = (ImageView) findViewById(R.id.imageView1);
Button captureBtn = (Button) findViewById(R.id.button1);

captureBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
// get image
}
}

Aucun commentaire:

Enregistrer un commentaire