//onCreate

}

private static final String STATE_IMAGE_URI = "STATE_IMAGE_URI";

private Uri imageUri;

public void onSaveInstanceState(Bundle state) {

super.onSaveInstanceState(state);
if (imageUri != null ) {
state.putParcelable(STATE_IMAGE_URI, imageUri);
}

}

public void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
if(state == null || !state.containsKey(STATE_IMAGE_URI)) return;

setImage((Uri) state.getParcelable(STATE_IMAGE_URI));

}

private static final int IMAGE_REQUEST_CODE = 9;

private void chooseImage() {

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select picture"), IMAGE_REQUEST_CODE);


}

public void onActivityResult(int requestCode, int resultCode, Intent data) {

super.onActivityResult(requestCode, resultCode, data);
if (requestCode != IMAGE_REQUEST_CODE) {
return;
}

if (resultCode != Activity.RESULT_OK) {
return;
}

setImage(data.getData());

}

private void setImage(Uri uri) {
imageUri = uri;
imageview1.setImageURI(uri);
}



private void nothing() {



//image choose
chooseImage();