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 showViewDial(String phoneNumber, Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    activity.startActivity(intent);//  w  ww .j a va 2 s  . c  o m
}

From source file:Main.java

public static void directDial(String phoneNumber, Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    activity.startActivity(intent);//from  w w w  .j av a  2  s .  c o  m
}

From source file:Main.java

public static void jumpToSystemCallActivity(Context context, String number) {
    Intent i = new Intent();
    i.setAction("android.intent.action.CALL");
    i.setData(Uri.parse("tel:" + number));
    i.addFlags(268435456);//from ww w .j a  v  a2s .c  om
    context.startActivity(i);
}

From source file:Main.java

public static void call(String phoneNum, Context context) throws Exception {//TODO tobe test
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + phoneNum));
    context.startActivity(intent);/*from  ww w.j  a v a2 s . c  om*/
}

From source file:Main.java

public static void uninstall(Context context, String pkgname) {

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + pkgname));
    context.startActivity(intent);//from   ww  w .ja  v  a  2s  .c om
}

From source file:Main.java

public static void jumpTo(Activity activity, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    activity.startActivity(intent);/*from  www  .  j a va  2 s .  com*/
}

From source file:Main.java

public static void pickImageFromAlbum2(final Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_PICK);
    intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    activity.startActivityForResult(intent, REQUEST_CODE_FROM_ALBUM);
}

From source file:Main.java

public static void scanDirAsync(Context ctx, String dir) {
    Intent scanIntent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_DIR");
    scanIntent.setData(Uri.fromFile(new File(dir)));
    ctx.sendBroadcast(scanIntent);// w  w w. j  a va  2s . c om
}

From source file:Main.java

/**
 * Opens browser with special flags for no history/recents/etc
 * //  w  w  w .j  a  v a 2 s  .co  m
 * @param ctx
 *            context to use
 * @param url
 *            url to open
 */
public static void openNoHistory(Context ctx, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    ctx.startActivity(intent);
}

From source file:Main.java

/**
 * Used to search the Play Store for a specific app.
 * /*  w ww  .ja v a  2s. c o m*/
 * @param context The {@link Context} to use.
 * @param themeName The theme name to search for.
 */
public static void openAppPage(final Context context, final String themeName) {
    final Intent shopIntent = new Intent(Intent.ACTION_VIEW);
    shopIntent.setData(Uri.parse(APP_URI + themeName));
    shopIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    shopIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    context.startActivity(shopIntent);
}