Example usage for android.content Intent URI_ALLOW_UNSAFE

List of usage examples for android.content Intent URI_ALLOW_UNSAFE

Introduction

In this page you can find the example usage for android.content Intent URI_ALLOW_UNSAFE.

Prototype

int URI_ALLOW_UNSAFE

To view the source code for android.content Intent URI_ALLOW_UNSAFE.

Click Source Link

Document

Flag for use with #toUri and #parseUri : allow parsing of unsafe information.

Usage

From source file:MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == PHOTO_RESULT && resultCode == RESULT_OK) {
        ImageView imageView = (ImageView) findViewById(R.id.imageView);
        imageView.setImageBitmap(BitmapFactory.decodeFile(mLastPhotoURI.getPath()));

        if (data != null) {
            imageView.setImageBitmap((Bitmap) data.getExtras().get("data"));

            try {
                imageView.setImageBitmap(MediaStore.Images.Media.getBitmap(getContentResolver(),
                        Uri.parse(data.toUri(Intent.URI_ALLOW_UNSAFE))));
            } catch (IOException e) {
                e.printStackTrace();/*from ww w.ja v a 2s  .  c o  m*/
            }
        }

    }
}