I'm trying to take a picture with the camera Intent and then immediately set the activity background to that image.
@SuppressWarnings("deprecation")
public void TakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
File photoFile = null;
try {
photoFile = SavePicture();
} catch (IOException ex) {
return;
}
if (photoFile != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photoFile));
startActivityForResult(takePictureIntent, 1);
RelativeLayout rl = (RelativeLayout)findViewById(R.id.activity_layout);
Bitmap bitmap = BitmapFactory.decodeFile(photoFile.getAbsolutePath());
Drawable dr = new BitmapDrawable(bitmap);
rl.setBackgroundDrawable(dr);
}
}
}
Just looking at my code, it doesn't look correct. Too much conversions from classes.
How would I go about doing this?