Example usage for android.content Intent setData

List of usage examples for android.content Intent setData

Introduction

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

Prototype

public @NonNull Intent setData(@Nullable Uri data) 

Source Link

Document

Set the data this intent is operating on.

Usage

From source file:Main.java

public static void callBrowser(Context context, String uri) {
    Intent intent = new Intent();
    intent.setData(Uri.parse(uri));
    intent.setAction(Intent.ACTION_VIEW);
    context.startActivity(intent);//from w w w . j a  v  a  2  s  .com
}

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);//w ww. ja v  a 2 s . c o  m
}

From source file:Main.java

public static void openKindleApp(Context context) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("kindle:"));
    context.startActivity(intent);//  w w  w . j a  v  a 2  s  .  co m
}

From source file:Main.java

private static Intent linkingToMarket(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    return intent;
}

From source file:Main.java

public static void call(String number, Context context) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + number));
    context.startActivity(intent);//  w  w  w.  ja va  2s . co m
}

From source file:Main.java

public static void dial(Context context, String phoneNum) {
    Intent dial = new Intent(Intent.ACTION_DIAL);
    dial.setData(Uri.parse("tel:" + phoneNum));
    context.startActivity(dial);/*from   w  w  w .jav a2 s . c  o m*/
}

From source file:Main.java

public static void gotoMarket(Activity activity) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://details?id=com.bitime.emoji"));
    activity.startActivity(intent);/*  www  . ja  va 2s  .  co  m*/
}

From source file:Main.java

public static void openGooglePlayForApp(Context context, String namespace) {
    Intent inPlay = new Intent(Intent.ACTION_VIEW);
    inPlay.setData(Uri.parse("market://details?id=" + namespace));
    context.startActivity(inPlay);//from ww  w  . j a v a  2  s. c o m
}

From source file:Main.java

public static void startBrowser(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    context.startActivity(intent);//from  w ww . ja  v  a  2  s  . c  om
}

From source file:Main.java

public static void openWeb(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);// w w  w.  j  a va 2 s.  c o  m
}