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 searchMarket(Activity caller, String paramtype, String value) {
    Uri uri = Uri.parse("market://search?q=" + paramtype + ":" + value);
    Intent intent = new Intent();
    intent.setData(uri);
    intent.setAction(Intent.ACTION_VIEW);
    caller.startActivity(intent);//from w  ww.  ja  v a 2s. c o  m
}

From source file:Main.java

public static void openEmail(Context context, String email) {
    Intent data = new Intent(Intent.ACTION_SENDTO);
    data.setData(Uri.parse(email));
    context.startActivity(data);//from ww  w  .  j a  v a2  s.  c  o m
}

From source file:Main.java

public static void sysCall(Context context, String callTo) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + callTo));
    context.startActivity(intent);//  w ww . ja va  2  s .c o  m
}

From source file:Main.java

public static void showMarketPublish(Context context, String publish) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://search?q=pub:" + publish));
    context.startActivity(intent);/*from   w  ww.  j  a  v  a  2  s  . com*/
}

From source file:Main.java

public static void showMarketProductBuyPackage(Context context, String pack) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://details?id=" + pack));
    context.startActivity(intent);/*from w  w w  .jav  a2 s. c  o m*/
}

From source file:Main.java

public static Intent getUninstallAppIntent(String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

public static void locationMarket(Context context, String packangeName) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://details?id=" + packangeName));
    context.startActivity(intent);/*from   w  w w.  jav  a  2  s.  c  om*/
}

From source file:Main.java

public static void startCall(Context context, String uri) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(uri));
    context.startActivity(intent);//from  w w w .j av  a  2 s.  co m
}

From source file:Main.java

public static void dial(Context context, String number) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + number));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/* w w w.j av  a2s .c  om*/
}

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