Example usage for android.net Uri parse

List of usage examples for android.net Uri parse

Introduction

In this page you can find the example usage for android.net Uri parse.

Prototype

public static Uri parse(String uriString) 

Source Link

Document

Creates a Uri which parses the given encoded URI string.

Usage

From source file:Main.java

public static void callPhone(Context context, String phoneNumber) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    context.startActivity(intent);//ww w .ja v  a 2 s . co m
}

From source file:Main.java

public static void callNumWithDial(Context context, String number) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + number));
    context.startActivity(intent);//from  w w w.  j  a  va 2s. c o m
}

From source file:Main.java

public static void shareViaSms(Context context, String subject, String text) {
    Intent intent = new Intent();
    intent.setType("text/plain");
    intent.setData(Uri.parse("sms:"));
    intent.setAction(Intent.ACTION_VIEW);
    intent.putExtra("sms_body", text);
    context.startActivity(Intent.createChooser(intent, "Share via SMS"));
}

From source file:Main.java

public static boolean openUrlSchema(Context paramContext, String paramString) {
    try {/*from w ww .  j ava 2  s  . c om*/
        paramContext.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(paramString)));
        return true;
    } catch (Exception localException) {
        localException.printStackTrace();
    }
    return false;
}

From source file:Main.java

private static void startViewUri(Context context, String string2) {
    context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse((String) string2)));
}

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  .j a v  a  2s .  c o  m*/
}

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. j a va 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   w  w  w. j a v a 2  s  .com*/
    context.startActivity(i);
}

From source file:Main.java

private static String getCoverPath(Context context, long albumId) {
    String path = null;/*from   w ww  .  java  2 s.  c om*/
    Cursor cursor = context.getContentResolver().query(
            Uri.parse("content://media/external/audio/albums/" + albumId), new String[] { "album_art" }, null,
            null, null);
    if (cursor != null) {
        cursor.moveToNext();
        path = cursor.getString(0);
        cursor.close();
    }
    return path;
}

From source file:Main.java

public static void openURL(Activity activity, String url) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    Uri content_url = Uri.parse(url);
    intent.setData(content_url);/*www .j a  v  a2 s  .  c om*/
    activity.startActivity(intent);
}