I am attempting to take a captured image and display to the Activity. When the image is set, it gets rotated to the right 90 degrees. I'm not sure what I am doing wrong. I capture the image by using MediaStore.ACTION_IMAGE_CAPTURE
and saved it and set it with a URI. Here's the code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_selectusername);
confirm = (Button) findViewById(R.id.confirm_select);
confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
takePhoto();
}
});
}
private void takePhoto() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photo = new File(Environment.getExternalStorageDirectory(), "temp.jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
//This is for photo editing purposes
inputURI = Uri.fromFile(photo);
outputURI = Uri.fromFile(new File(getCacheDir(), photoname));
//Cropping, Resizing, etc. takes place
startActivityForResult(intent, TAKE_PICTURE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent result) {
super.onActivityResult(requestCode, resultCode, result);
if(requestCode == TAKE_PICTURE && resultCode == RESULT_OK){
ImageView imageView = (ImageView) findViewById(R.id.profilepicture_select);
imageView.setImageURI(outputURI);
}else{
Log.d("TEST", "Something went wrong!");
}
}
I can show more code and clarify if necessary. All Help is appreciated!