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 callTel(Activity activity, String number) {
    Uri uri = Uri.parse("tel:" + number);
    Intent intent = new Intent(Intent.ACTION_CALL, uri);
    activity.startActivity(intent);//from  w w w. j a  v  a  2 s  . c o  m
}

From source file:Main.java

public static final Intent getEditorIntent() {
    Uri uri = Uri.parse("market://details?id=net.fhtagn.zoobeditor");
    Intent i = new Intent(Intent.ACTION_VIEW, uri);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return i;//w ww. j a v  a2s  .c o  m
}

From source file:Main.java

public static Uri getSongUri(int id) {
    String albumId = String.valueOf(id);
    Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart");
    Uri albumArtUri = ContentUris.withAppendedId(sArtworkUri, Integer.valueOf(albumId));
    return albumArtUri;
}

From source file:Main.java

public static void goToWebPage(Context context, String url) {
    Uri uriUrl = Uri.parse(url);
    Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
    context.startActivity(launchBrowser);
}

From source file:Main.java

public static void goWebByUrl(Context context, String url) {
    Uri uri = Uri.parse(url);
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(intent);/*from  ww  w . j  a va  2s . c om*/
}

From source file:Main.java

public static Intent createSmsToIntent(String text) {
    Intent sendIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"));
    sendIntent.putExtra("sms_body", text);
    return sendIntent;
}

From source file:Main.java

public static void makePhoneCall(Activity activity, String phone) {
    Uri uri = Uri.parse("tel:" + phone);
    Intent it = new Intent(Intent.ACTION_DIAL, uri);
    activity.startActivity(it);/*from w  w w .  j  a v a  2 s  . c  om*/
}

From source file:Main.java

public static void openBrowser(Activity activity, String url) {
    final Uri uri = Uri.parse(url);
    final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    activity.startActivityIfNeeded(intent, 0);
}

From source file:Main.java

public static void openDial(Context getContext, String number) {
    Uri uri = Uri.parse("tel:" + number);
    Intent it = new Intent(Intent.ACTION_DIAL, uri);
    getContext.startActivity(it);/*from w w w .jav  a 2 s.  co m*/
}

From source file:Main.java

public static void sendMessage(Activity activity, String phone) {

    Uri uri = Uri.parse("smsto:" + phone);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    activity.startActivity(intent);// w ww . j a  va  2s  .  c  o m
}