List of usage examples for android.net Uri parse
public static Uri parse(String uriString)
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);//from w w w . ja v a2 s. c o m intent.setAction(Intent.ACTION_VIEW); caller.startActivity(intent); }
From source file:Main.java
public static Uri convertDrawabletoUri(int resourceId) { return Uri.parse(String.format("android.resource://%s/%d", packageName, resourceId)); }
From source file:Main.java
public static void openWeb(Context context, String url) { Uri uri = Uri.parse(url); context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); }
From source file:Main.java
static Uri uriStripQueryParameter(Uri uri, String paramKey) { String queryParam = uri.getQueryParameter(paramKey); if (queryParam == null) { // nothing to strip return uri; } else {/*w ww .j av a 2 s. c om*/ String uriString = uri.toString(); String paramString = paramKey + "=" + queryParam; if (uri.getQuery().length() == paramString.length()) { paramString = "?" + paramString; } else if (uriString.length() - paramString.length() == uriString.indexOf(paramString)) { paramString = "&" + paramString; } else { paramString = paramString + "&"; } return Uri.parse(uriString.replace(paramString, "")); } }
From source file:Main.java
private static AlertDialog showDownloadDialog(final Activity activity, CharSequence stringTitle, CharSequence stringMessage, CharSequence stringButtonYes, CharSequence stringButtonNo) { AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity); downloadDialog.setTitle(stringTitle); downloadDialog.setMessage(stringMessage); downloadDialog.setPositiveButton(stringButtonYes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { Uri uri = Uri.parse("market://search?q=pname:org.torproject.android"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); activity.startActivity(intent); }/*ww w .ja va 2 s .com*/ }); downloadDialog.setNegativeButton(stringButtonNo, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { } }); return downloadDialog.show(); }
From source file:Main.java
public static void openURL(Context mContext, String url) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); mContext.startActivity(intent);/*from w w w. j av a 2 s. com*/ }
From source file:Main.java
public static void sendMail(Context mContext, String mailID) { Uri uri = Uri.parse("mailto:" + mailID); mContext.startActivity(new Intent(Intent.ACTION_SENDTO, uri)); }
From source file:Main.java
public static void sedSMS(Context context, String phone) { Uri uri = Uri.parse("smsto:" + phone); Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri); sendIntent.putExtra("sms_body", ""); context.startActivity(sendIntent);/*w w w .j a v a 2 s .c om*/ }
From source file:Main.java
public static void sendSMS(Context cxt, String smsBody) { Uri smsToUri = Uri.parse("smsto:"); Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri); intent.putExtra("sms_body", smsBody); cxt.startActivity(intent);//from www . ja v a 2 s .c o m }
From source file:Main.java
public static void openContacts(Activity context, int requestCode) { Uri uri = Uri.parse("content://contacts/people"); context.startActivityForResult(new Intent(Intent.ACTION_PICK, uri), requestCode); }