Code example for DialogFragment

Methods: onSaveInstanceState

0
        this.path = path;
    } 
 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putString("path", path);
    } 
 
    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        if (savedInstanceState != null) {
            path = savedInstanceState.getString("path");
        } 
 
        Bitmap bitmap = BitmapFactory.decodeFile(path);
 
 
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.UserAvatarDialog);
        View customView = getActivity().getLayoutInflater().inflate(R.layout.useravatardialog_layout, null);
        ((ImageView) customView.findViewById(R.id.imageview)).setImageBitmap(bitmap);