public static void openFile(String filePath) {
    File file = new File(filePath);
    String extension = "";
    int i = filePath.lastIndexOf('.');
    int p = Math.max(filePath.lastIndexOf('/'), filePath.lastIndexOf('\\'));
    if (i > p) extension = filePath.substring(i + 1);
    String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());

    if (type == null) type = "*/*";

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), type);
    instance.startActivity(intent);
  }
 public static void shareLink(String link) {
   Intent share = new Intent(Intent.ACTION_SEND);
   share.setType("text/plain");
   share.putExtra(Intent.EXTRA_TEXT, link);
   instance.startActivity(Intent.createChooser(share, ""));
 }