title: Receiving intent from activity
body: <p>I have one problem. I have my own file explorer and I want to implement functions for in-app file opening (namely images, videos, pdfs and so) and this is my code</p>
  
  <pre><code>public static void openFile(final Context context, final File target) {
      final String mime = MimeTypes.getMimeType(target);
      final Intent i = new Intent(Intent.ACTION_VIEW);
  
      if (mime != null) {
          i.setDataAndType(Uri.fromFile(target), mime);
      } else {
          i.setDataAndType(Uri.fromFile(target), "*/*");
      }
  
      if (context.getPackageManager().queryIntentActivities(i, 0).isEmpty()) {
          Toast.makeText(context, R.string.cantopenfile, Toast.LENGTH_SHORT)
                  .show();
          return;
      }
  
      try {
          context.startActivity(i);
      } catch (Exception e) {
          Toast.makeText(context,
                  context.getString(R.string.cantopenfile) + e.getMessage(),
                  Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p>My question is, how can I make the activities for viewing specified files and how to get intents to it ?
  Thank you.
  Please use code as answer and if there are any manifest changes please write them. Thanks :)</p>