title: getting a Bitmap from a Uri
body: <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_view_image);
  
     imageView = (ImageView) findViewById(R.id.imageView);
  
      Intent intent = getIntent();
      Uri imageUri = intent.getData();
     // Picasso.with(this).load(imageUri).into(imageView);
  
      if(imageUri == null){
          Log.d(TAG, "Check");
      }
  
  
  
  
  
  
          //BitmapFactory.Options options = new BitmapFactory.Options();
       //   options.inSampleSize = 8;
       //   bm = MediaStore.Images.Media.getBitmap(getContentResolver(),imageUri);
  
      Bitmap bm = null;
  
      try{
          InputStream image;
      try{
          image = getContentResolver().openInputStream(imageUri);
          bm = BitmapFactory.decodeStream(image);
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      }
      }
      catch (Exception e){
          e.printStackTrace();
      }
  
  
  
  
      //BitmapFactory.Options options = new BitmapFactory.Options();
     // bm = BitmapFactory.decodeFile(file.getAbsolutePath(),options);
  
  
      if ((bm == null)) {
          prints("It doesn't work");
      }
  
      //Log.d(TAG,"Going to convert image.");
        imageView.setImageBitmap(bm);
  </code></pre>
  
  <p>I've looked at a bunch of StackOverFlow questions, I've tried them all as you can see in the commented code. I'm trying to get a Bitmap that is unchanged when the photo is taken. The pixel position of the Bitmap is crucial for my goal. The image is high quality and maybe a larger file. My Bitmap is always null, I have made sure my Uri isn't. Any ideas? </p>