Example usage for android.content Intent ACTION_VIEW

List of usage examples for android.content Intent ACTION_VIEW

Introduction

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

Prototype

String ACTION_VIEW

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

Click Source Link

Document

Activity Action: Display the data to the user.

Usage

From source file:Main.java

public static void installApk(Activity activity, String path) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive");
    activity.startActivity(intent);//from  www  .  ja  va  2s. c  om
}

From source file:Main.java

public static void installApp(Context context, File apkFile) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
    context.startActivity(intent);//from w  w  w  .  j a v a  2s .c  o m
}

From source file:Main.java

public static void installApk(Context context, String filename) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(filename)), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from   ww  w.  j  a v  a2  s  . com*/
}

From source file:Main.java

public static void installApk(Context context, String filePath) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(filePath)), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from  w  ww.j ava  2  s . co  m*/
}

From source file:Main.java

public static void openUrl(Context context, String url) {
    Uri uri = Uri.parse(url);/*from   ww  w .  j  a va 2s .  c o m*/
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(intent);
}

From source file:Main.java

public static void installApk(Context context, File apkFile) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);// ww  w .  j a v  a 2s .  co m
}

From source file:Main.java

public static void openBrowserInNewTask(Context context, String url) {
    context.startActivity(/*ww  w.  j  a  va2 s .  com*/
            new Intent(Intent.ACTION_VIEW, Uri.parse(url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}

From source file:Main.java

public static void intentDirection(Context context, double latitude, double longitude) {
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
            Uri.parse("http://maps.google.com/maps?daddr=" + latitude + "," + longitude));
    context.startActivity(intent);/*www.  j  a va2 s. c  o  m*/
}

From source file:Main.java

public static void installAPK(String fileName, Context context) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
    context.startActivity(intent);//from   w  w  w.j a  va  2s  .  c om
}

From source file:Main.java

public static void openBrowser(Context context, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));//  www  . j  a  v  a 2  s .  co  m
    context.startActivity(intent);
}