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 gotoMarket(Context context, String pck) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://details?id=" + pck));
    context.startActivity(intent);//w w  w  .  j a v a2  s.  c  o  m
}

From source file:Main.java

public static void goGoogleMarket(Context context) {
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse("market://search?q=" + context.getPackageName()));
    context.startActivity(i);/*from   w  w  w.ja  v  a 2 s. co  m*/
}

From source file:Main.java

public static final void viewImageFromUri(Context ctx, Uri u) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(u, "image/*");
    ctx.startActivity(intent);/*w ww  .j a va 2 s  .co  m*/
}

From source file:Main.java

public static void gotoWeb(Context context, String url) {
    try {/*from  w  ww.  j a v  a2  s  .  c  o  m*/
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(url));
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY
                | Intent.FLAG_FROM_BACKGROUND);
        // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void openMap(Context context, String uri) {
    Uri mUri = Uri.parse(uri);//from   w w w  . ja v  a 2  s.  co  m
    Intent mIntent = new Intent(Intent.ACTION_VIEW, mUri);
    context.startActivity(mIntent);
}

From source file:Main.java

public static void openLink(Context context, String url) {
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    i.setData(Uri.parse(url));/*  w ww.j  a v  a 2 s . c om*/
    context.startActivity(i);
}

From source file:Main.java

public static void goWebByUrl(Context context, String url) {
    Uri uri = Uri.parse(url);//from  w  ww  .jav a2  s . c  o m
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(intent);
}

From source file:Main.java

public static void IntentWebPage(Context context, String url) {
    Uri uri = Uri.parse(url);/*  ww  w  .  j  ava2s  .c  om*/
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(it);
}

From source file:Main.java

public static void install(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);//from w w  w .  ja  v  a2 s. co m
}

From source file:Main.java

public static void viewURL(Context context, String url) {
    Intent viewURLIntent = new Intent(Intent.ACTION_VIEW);
    viewURLIntent.setData(Uri.parse(url));
    context.startActivity(viewURLIntent);
}