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 final Intent buyFullIntent() {
    Uri fullVersionURI = Uri.parse("market://details?id=net.fhtagn.zoobgame");
    Intent i = new Intent(Intent.ACTION_VIEW, fullVersionURI);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return i;//from w  ww.  j a v  a  2s.c om
}

From source file:Main.java

public static void openDownloadWeb(Context context, String url) {
    Uri uri = Uri.parse(url);//from  www . j a v  a 2s .  c o m
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(it);
}

From source file:Main.java

public static void install(Context context, File file) {
    if (!file.exists()) {
        return;/*from  w w w. j  a v a  2 s  .  co m*/
    }
    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);
}

From source file:Main.java

static PendingIntent createOpenCalendarEventPendingIntent(Context context) {
    Intent intent = createCalendarIntent(Intent.ACTION_VIEW);
    return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}

From source file:Main.java

/**
 * /*from   w w  w .j  a  v  a2  s.  c  om*/
 * @param activity
 * @param url
 */
public static void openBrowserWithUrl(Activity activity, String url) {
    Intent openBrowserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    activity.startActivity(openBrowserIntent);
}

From source file:Main.java

public static Intent newMapIntent_LatLong(Context context, double lat, double lng) {
    String uri = String.format("geo:%f,%f", lat, lng);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
    return intent;
}

From source file:Main.java

public static void installApp(Context mContext, String path) {
    Intent i = new Intent();
    i.setAction(Intent.ACTION_VIEW);
    i.addCategory(Intent.CATEGORY_DEFAULT);
    i.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive");
    mContext.startActivity(i);/*from w  w  w  . j av a 2s  .c  o  m*/
}

From source file:Main.java

public static void installApk(Context context, Uri file) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(file, "application/vnd.android.package-archive");
    context.startActivity(intent);/*from   ww  w  . j av  a2s .  c  om*/
}

From source file:Main.java

@NonNull
public static Intent sendSms(@NonNull String to, @NonNull String message) {
    final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:" + to));
    intent.putExtra("sms_body", message);
    return intent;
}

From source file:Main.java

public static void startInstallAPK(Context context, String path) {
    try {//ww  w .j a  v a2s .co m
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive");
        context.startActivity(intent);
    } catch (Exception e) {

    }
}