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 composeTel(Context context, String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:" + phoneNumber));
    context.startActivity(intent);/* w ww  .ja v  a2 s . c o m*/
}

From source file:Main.java

public static void downloadGooglePlayServices(Activity activity) {
    Intent marketIntent = new Intent(Intent.ACTION_VIEW,
            Uri.parse("market://details?id=com.google.android.gms"));
    activity.startActivity(marketIntent);
}

From source file:Main.java

public static Intent createShortcutIntent(String url) {
    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    long urlHash = url.hashCode();
    long uniqueId = (urlHash << 32) | shortcutIntent.hashCode();
    shortcutIntent.putExtra(Browser.EXTRA_APPLICATION_ID, Long.toString(uniqueId));
    return shortcutIntent;
}

From source file:Main.java

public static void openInBrowser(Activity activity, String link) {
    Intent sharingIntent = new Intent(android.content.Intent.ACTION_VIEW);
    sharingIntent.setData(Uri.parse(link));
    activity.startActivity(sharingIntent);
}

From source file:Main.java

public static void installApk(Context context, String apkPath) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.parse("file://" + apkPath), "application/vnd.android.package-archive");
    context.startActivity(intent);//from   w ww .  j  a  v  a 2  s.  c  o m
}

From source file:Main.java

public static void installApkByPath(Context context, String filePath) {
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setDataAndType(Uri.parse("file://" + filePath), "application/vnd.android.package-archive");
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);//  w w w  .  j  av a  2s  .  c o  m
}

From source file:Main.java

public static void installApk(Context context, String apkPath) {

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.parse("file://" + apkPath), "application/vnd.android.package-archive");

    context.startActivity(intent);//  ww w.ja va 2  s .  c o m
}

From source file:Main.java

public static void installApk(Context context, String apkFilePath) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.parse("file://" + apkFilePath), "application/vnd.android.package-archive");
    context.startActivity(intent);//from www . j  av  a 2 s.  c o m
}

From source file:Main.java

public static Intent launchEventById(long id) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri.Builder uri = Events.CONTENT_URI.buildUpon();
    uri.appendPath(Long.toString(id));
    intent.setData(uri.build());/*  www .  j av a 2  s .c om*/
    return intent;
}

From source file:Main.java

public static void searchTingting(Context context, String appName) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://search?q=pub:" + appName + ""));
    context.startActivity(intent);//from   www .  jav  a  2  s  .c  o m
}