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 openBrowser(Context context, String s) {
    Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(s));
    intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");
    context.startActivity(intent);/* www  .  j  a  v a2s .  c  o m*/
}

From source file:Main.java

public static void rateTheApp(Activity activity) {
    Intent goToMarket = new Intent(Intent.ACTION_VIEW,
            Uri.parse("market://details?id=" + activity.getPackageName()));
    activity.startActivity(goToMarket);/*from  w  ww  .  j  a  v  a2s.c  o m*/
}

From source file:Main.java

public static void makeACall(String phonenUmber, Context context) {
    Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phonenUmber));
    context.startActivity(callIntent);/*from   w w w  . java2 s .  co m*/
}

From source file:Main.java

public static Intent createShortcutIntent(String url) {
    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    long urlHash = url.hashCode();
    long uniqueId = (urlHash << 32) | shortcutIntent.hashCode();
    shortcutIntent.putExtra(Browser.EXTRA_APPLICATION_ID, Long.toString(uniqueId));
    return shortcutIntent;
}

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);//  w ww .j  av  a2 s.  com
}

From source file:Main.java

/**
 * Get an account name/*from  ww  w . j  a va2s  .c om*/
 *
 * @param blogUrl
 * @param email
 * @return
 */
public static String getName(String blogUrl, String email) {
    Uri uri = Uri.parse(blogUrl);
    return email + " (" + uri.getHost() + ")";
}

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

From source file:Main.java

public static void openWebSite(Context context, String url) {
    Uri uri = Uri.parse(url);
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(it);//from   w ww  .  j  a v  a  2  s  . c om
}

From source file:Main.java

public static void sendMsg(Context context, String sentTo) {
    Uri smsToUri = Uri.parse("smsto:" + sentTo);
    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    intent.putExtra("sms_body", "");
    context.startActivity(intent);//  w  ww  .j a v a2s.c  o  m
}

From source file:Main.java

public static void callPhone(Context context, String phoneNumber) {
    context.startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber)));
}