title: Android: how to open image from gallery?
body: <p>I've created a method in my app that saves my layout as an image and presents it in the gallery.
  I'm trying to open it but I'm having a hard time with all the tutorials and different approaches...</p>
  
  <p>This is my code:</p>
  
  <pre><code>SimpleDateFormat mTimeFormat = new SimpleDateFormat("dd-MM-yyyy");
          Date mTime = new Date();
          String mStringTime = mTimeFormat.format(mTime);
  
          String fileFolder = "/orders";
          String fileName = "/order-"+mStringTime;
          File filePath = new File("/sdcard"+fileFolder+fileName+".png");
          Uri fileUri = Uri.fromFile(filePath);
  
          File createFolder = new File(Environment.getExternalStorageDirectory()+fileFolder);
          if (!createFolder.exists()){ //checks I don't create the same folder twice
              createFolder.mkdir();
          }
  
          View orderView = findViewById(R.id.tableOrder); //this is what i shall save
          orderView.setDrawingCacheEnabled(true);
          Bitmap bitmap = orderView.getDrawingCache();      
  
          try {
              FileOutputStream outputImage = new FileOutputStream(filePath);
              bitmap.compress(CompressFormat.PNG, 10, outputImage);
              outputImage.close();
              orderView.invalidate();     
  
              Intent intentScanner = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
              intentScanner.setData(fileUri);
              sendBroadcast(intentScanner);
  
          } 
          catch (Exception e) 
          { e.printStackTrace();
          } finally{
              orderView.setDrawingCacheEnabled(false);  
  
              Intent intentView = new Intent(Intent.ACTION_VIEW);
              intentView.setType("image/*");
              intentView.setData(fileUri);
              startActivity(intentView);
          }
  </code></pre>
  
  <p>when running the app crashes, but the image is being saved</p>
  
  <pre><code>android.content.ActivityNotFoundException: No Activity found to handle Intent
  </code></pre>
  
  <p>premissions:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>What should I do?</p>