android-contentresolver

How to batch update datas in ContentProvider,something confused me

自作多情 提交于 2019-12-08 08:24:45
问题 How can i execute this sql in content Provider as below: update dtrips set dtp_day_idx=dtp_day_idx+2 where tp_id=1 Can anyone help me fix the code DTrip dTrip = new DTrip(); ContentValues values = createContentValues(dTrip); values.put("dtp_day_idx" ,...); String select ="tp_id="+tripId; mContentResolver.update(UsersColumns.CONTENT_URI, values, select, null); Thanks. 来源: https://stackoverflow.com/questions/9155395/how-to-batch-update-datas-in-contentprovider-something-confused-me

ContentResolver Change gallery folder name

半腔热情 提交于 2019-12-08 04:32:08
问题 i'm using the code specified here to store a Bitmap image and show it into the gallery. Unfortunately that code let me store image to "Pictures" folder into the Gallery. Is it possible to change the folder name with a name that i decide? 回答1: OK, I've modified the code from your link and tested this code. just use this: public class CapturePhotoUtils { private static String folderName = "yourFolderName"; /** * A copy of the Android internals insertImage method, this method populates the *

Is there a Bookmark Contentprovider for Chrome to get browser history

瘦欲@ 提交于 2019-12-08 02:52:00
问题 I have an app that use ContentResolver to get the Browser history data with Browser.BOOKMARKS_URI. It works well with the stock Android browser. Now Google is moving to Chrome as the default browser. Does Chrome provide similar Contentprovider? I searched all over the web but could not find any information on this. Is there a doc for Chrome on Android released by Google yet? Thanks in advance! 回答1: https://groups.google.com/a/chromium.org/forum/?fromgroups=#!topic/chromium-bugs/ThAoOAYOPCk

Android fails to call SQLite WHERE column LIKE '%?%' The statement has 0 parameters

佐手、 提交于 2019-12-08 01:24:31
问题 With this code public static List<App> findByKeyword(Context context, String keyword){ ContentResolver resolver = context.getContentResolver(); Uri uri = getContentUri(); String[] projection = DataColumns.ALL; String selection = DataColumns.NAME+" like '%?%' "; String[] selectionArgs = {keyword}; Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, DEFAULT_ORDER ); return cursorToList(cursor); } I get error Caused by: java.lang.IllegalArgumentException: Cannot bind

Can an app get a permission to a whole sub tree from SAF?

[亡魂溺海] 提交于 2019-12-07 21:37:25
问题 Can a third party app request a Storage provider through Storage Access Framework to grant it with premissions to delete files within\copy files to a directory or in any subtree underneath the tree Uri recieved onActivityResult by a call to startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE),14) ? If it can, how do you claim it on the third party app code? I tried getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION); but when i try

How to Get File Path from URI in Android Oreo (8.1) or above

我的未来我决定 提交于 2019-12-07 05:50:26
问题 Expected Behavior When I am selecting the file which is stored inside "Download", it should able to retrieves its file name and path Actual Behavior When I am selecting the file which is stored inside "Download", it returns null. Steps to Reproduce the Problem When picking file method is called, it displays the folders in Android Go to downloads, select a file It returns null in getting real path from URI Here is the code what i implemented public static String getPath(final Context context,

Does ContentResolver notifyChange method notifies also detail Uri's?

房东的猫 提交于 2019-12-07 00:37:21
问题 During applying data I use notifyChange with an Uri . Let's say I notify content://com.package.my/items . I have also detail Activity that displays data from content://com.package.my/items/1 . Does notifying 'general' Uri results also in 'detail' Uri being notified? 回答1: The method notifyChange sends a notification for the detailed URI. But if you register a ContentObserver at ContentResolver.registerContentObserver(Uri uri, boolean notifyForDescendents, ContentObserver observer) you can

Contact fetching takes too much time

ε祈祈猫儿з 提交于 2019-12-06 20:57:26
In my code the contact fetching takes too much time to fetch the contacts and show in the application. Please guide me where i am wrong and what should i correct in order to make execution time fast. Here is my code. ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null ); String phone = null; List<String> phonenumber = new ArrayList<String>(); String emailContact = null; String emailType = null; String image_uri = ""; Bitmap bitmap = null; if (cur.getCount() > 0) { while (cur.moveToNext()) { String id = cur.getString(cur

How to batch update datas in ContentProvider,something confused me

 ̄綄美尐妖づ 提交于 2019-12-06 15:06:52
How can i execute this sql in content Provider as below: update dtrips set dtp_day_idx=dtp_day_idx+2 where tp_id=1 Can anyone help me fix the code DTrip dTrip = new DTrip(); ContentValues values = createContentValues(dTrip); values.put("dtp_day_idx" ,...); String select ="tp_id="+tripId; mContentResolver.update(UsersColumns.CONTENT_URI, values, select, null); Thanks. 来源: https://stackoverflow.com/questions/9155395/how-to-batch-update-datas-in-contentprovider-something-confused-me

Android fails to call SQLite WHERE column LIKE '%?%' The statement has 0 parameters

蹲街弑〆低调 提交于 2019-12-06 11:18:18
With this code public static List<App> findByKeyword(Context context, String keyword){ ContentResolver resolver = context.getContentResolver(); Uri uri = getContentUri(); String[] projection = DataColumns.ALL; String selection = DataColumns.NAME+" like '%?%' "; String[] selectionArgs = {keyword}; Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, DEFAULT_ORDER ); return cursorToList(cursor); } I get error Caused by: java.lang.IllegalArgumentException: Cannot bind argument at index 1 because the index is out of range. The statement has 0 parameters. The SQLite raw query