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 installApp(Context context, File file) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    context.startActivity(intent);//from  w  w w  .j a  v a  2s. c om
}

From source file:Main.java

public static void installApk(Context context, File file) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    context.startActivity(intent);/* w w  w  .ja v  a 2  s  . c  o m*/
}

From source file:Main.java

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

From source file:Main.java

public static void openPost(Context context, String postUrl) {
    try {/*from www .  j av  a  2 s . c  o m*/
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(postUrl));
        context.startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void install(Context context, File file) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*  w ww.ja  v  a2  s.c om*/
}

From source file:Main.java

public static void install(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(new File(url)), "application/vnd.android.package-archive");
    context.startActivity(intent);// ww  w  .j  av  a 2s  . c o  m
}

From source file:Main.java

public static void install(Context context, String mUrl) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(mUrl)), "application/vnd.android.package-archive");
    context.startActivity(intent);//from   ww  w .j  a  va2 s  .  c  o m
}

From source file:Main.java

public static void link(Context context, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.addCategory(Intent.CATEGORY_BROWSABLE);
    intent.setData(Uri.parse(url));// w ww . j  a va 2 s .com
    context.startActivity(intent);
}

From source file:Main.java

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

From source file:Main.java

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