List of usage examples for android.net Uri parse
public static Uri parse(String uriString)
From source file:Main.java
private static void uninstallAppByClick(Context context, String pkgName) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_DELETE); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("package:" + pkgName)); context.startActivity(intent);/*from w ww . ja v a 2 s . c o m*/ }
From source file:Main.java
public static Cursor getAllCallLogs(ContentResolver cr) { // reading all data in descending order according to DATE String strOrder = CallLog.Calls.DATE + " DESC"; Uri callUri = Uri.parse("content://call_log/calls"); Cursor curCallLogs = cr.query(callUri, null, null, null, strOrder); return curCallLogs; }
From source file:Main.java
/** * Convert a String to an Android Uri (Not URI) * @param path String path to convert/* w ww . ja v a2 s .c o m*/ * @return android.net.Uri */ public static android.net.Uri convertStringToAndroidUri(String path) { try { android.net.Uri toReturn = Uri.parse(path); return toReturn; } catch (Exception e) { return null; } }
From source file:Main.java
public static void startExplorer(Context context, String url) { if (url == null) { return;// w w w. ja v a 2 s. c o m } Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse(url); intent.setData(content_url); context.startActivity(intent); }
From source file:Main.java
public static boolean uninstallApk(Context context, String packageName) { if (TextUtils.isEmpty(packageName)) { return false; }/*from w ww .j a v a 2 s . com*/ Intent i = new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + packageName)); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); return true; }
From source file:Main.java
public static void makeingCalls(Context context, String phoneNum) { if (TextUtils.isEmpty(phoneNum)) { return;//from w ww . ja v a 2 s . c o m } Intent phoneIntent = new Intent("android.intent.action.CALL", Uri.parse("tel:" + phoneNum)); phoneIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(phoneIntent); }
From source file:Main.java
public static String uriTitle(Context context, String contentUri) { String result = null;/* ww w .j a v a2s .co m*/ String[] p = { MediaStore.MediaColumns.TITLE }; Uri uri = Uri.parse(contentUri); if (!uri.getScheme().equals("content")) { return (fileUriTitle(context, contentUri)); } Cursor cursor = context.getContentResolver().query(uri, p, // which columns null, // which rows (all rows) null, // selection args (none) null); // order-by clause (ascending by name) if (cursor != null) { int iColumn = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.TITLE); if (cursor.moveToFirst()) { result = cursor.getString(iColumn); } } return (result); }
From source file:Main.java
public static void installApk(Context context, String apkPath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + apkPath), "application/vnd.android.package-archive"); context.startActivity(intent);//from w w w .ja va2 s. co m }
From source file:Main.java
public static void uninstallApp(String packageName, Activity activity) { Intent intent = new Intent(); intent.setAction("android.intent.action.DELETE"); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("package:" + packageName)); activity.startActivityForResult(intent, 0); }
From source file:Main.java
public static void startURLActivity(Activity context, String strURL) { if (strURL == null) return;//from w ww . j a v a 2 s. c o m if (URLUtil.isValidUrl(strURL) == false) return; Uri url = Uri.parse(strURL); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(url); context.startActivity(i); }