List of usage examples for android.net Uri parse
public static Uri parse(String uriString)
From source file:Main.java
public static void openUrl(Context c, String url) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.putExtra(Browser.EXTRA_APPLICATION_ID, c.getPackageName()); checkContextIsActivity(c, intent);//from w w w . j a v a 2s .c o m c.startActivity(intent); }
From source file:Main.java
public static boolean sendEmailToDeveleper(Activity act) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("https://mail.qq.com"); intent.setData(content_url);/* www . ja v a2 s. c o m*/ act.startActivity(intent); return true; }
From source file:Main.java
public static void call(Context context, String s) { try {//from w w w.j a va2s .c o m context.startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:" + s))); } catch (Exception e) { context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("tel:" + s))); } }
From source file:Main.java
public static void startBrowser(Context context, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); context.startActivity(intent);// ww w . ja v a2s .c om }
From source file:Main.java
public static Intent newEmailIntent(String toAddress, String subject, String body, String cc) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:" + Uri.encode(toAddress) + "?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body) + "&cc=" + Uri.encode(cc))); return intent; }
From source file:Main.java
public static void viewMaps(Context context, String addressText) { String uri = "geo:" + 0 + "," + 0 + "?q=" + addressText; context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uri))); }
From source file:Main.java
public static void viewURL(Context context, String url) { Intent viewURLIntent = new Intent(Intent.ACTION_VIEW); viewURLIntent.setData(Uri.parse(url)); context.startActivity(viewURLIntent); }
From source file:Main.java
public static void unInstallApkFromPackage(Context context, String apk_pkg) { try {//from ww w . j a va 2 s .c om Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + apk_pkg)); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * get the connection proxy and port/*from w ww.jav a 2 s. c om*/ * @param context * @return */ public static String[] getHostAndProxy(Context context) { Uri uri = Uri.parse("content://telephony/carriers/preferapn"); Cursor mCursor = context.getContentResolver().query(uri, null, null, null, null); if (mCursor != null) { mCursor.moveToNext(); String proxyStr = mCursor.getString(mCursor.getColumnIndex("proxy")); String port = mCursor.getString(mCursor.getColumnIndex("port")); return new String[] { proxyStr, port }; } return null; }
From source file:Main.java
public static void gotoCall(Context context, String phoneNumber) { try {/*w w w . j av a2s . com*/ Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel://" + phoneNumber)); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }