android-contentprovider

Android Browser.BOOKMARKS_URI does not work on all devices. How to find out the correct uri for a given device?

大城市里の小女人 提交于 2019-11-28 10:13:30
I am trying to use Android Browser.BOOKMARKS_URI to CRUD device bookmarks from within my app ( https://play.google.com/store/apps/details?id=com.elementique.web ) It's working fine on most of the devices, but does not work on some :-( On those devices, trying to use bookmarks leads to java.lang.IllegalArgumentException: Unknown URL content://browser/bookmarks I now understand that Boookmark Uri can be different than the AOSP default value (i.e. "content://browser/bookmarks"). Question: How can I get the correct Bookmark Uri for a given device? I already 'collected' the following URI private

Cursor.getType() for API Level <11

爱⌒轻易说出口 提交于 2019-11-28 09:41:12
I'm querying the CallLog content provider and need to detect the column types. In Honeycomb and newer (API Level 11+) you can get a columns preferred data type by calling the method Cursor.getType(int columnIndex) which returns one of the following types: FIELD_TYPE_NULL (0) FIELD_TYPE_INTEGER (1) FIELD_TYPE_FLOAT (2) FIELD_TYPE_STRING (3) FIELD_TYPE_BLOB (4) How can I accomplish this on pre-Honeycomb <11 devices? I've tried the following: for ( int i = 0; i < cursor.getColumnCount(); i++ ) { int columnType = -1; try { cursor.getInt( i ); columnType = Cursor.FIELD_TYPE_INTEGER; } catch (

SGS-3 bug related to SMS conversations list?

你。 提交于 2019-11-28 09:28:02
This issue was reported several times, but still not resolved yet. I read all messages/thread which somehow related to this topic either in Samsung's developers site or in StackOverflow Let me again describe whole problem just in few words: Developers used to get list of SMS conversations through simple query like: Uri.parse("content://mms-sms/conversations/"); Cursor cursor = context.getApplicationContext().getContentResolver().query(uri, null, null, null, null); or something like this. Key point here's URI address: content://mms-sms/conversations Everyone knows that it's unofficial and one's

Android - get date time from SMS timestamp in miliseconds

别来无恙 提交于 2019-11-28 09:11:45
问题 is it possible to convert Sms table date value e.g. 1293457709636 (miliseconds) to meaningful Date time value. 回答1: just do long ms = 1293457709636; // or whatever you have read from sms Date dateFromSms = new Date(ms); 回答2: You can convert Sms table date in to meaningful Date time like this. import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS"); Calendar calendar = Calendar.getInstance

How to represent 2 cursors as 1 sorted cursor?

て烟熏妆下的殇ゞ 提交于 2019-11-28 08:43:52
问题 I have 2 different sets of data, each of them use its own ContentProvider . Querying to them I can get 2 different cursors. Those 2 cursors has 2 different primary keys, but there's one and the same field ( DATE ) which I can use for ordering (other fields are different). My goal is to have one final merged Cursor which will be sorted by those DATE field. I have investigated MergeCursor but it doesn't fit to me, since it returns merged/concatenated (but not sorted Cursor ). Any ideas, clues?

When should I call close() on SQLiteOpenHelper used by ContentProvider

♀尐吖头ヾ 提交于 2019-11-28 08:26:01
In my android app, I use SQLiteOpenHelper to implements ContentProvider. Query, add, delete operations are all through ContentProvider. But in one of my android phone(htc g13), I found *.db-wal file in directory /data/data/[package name]/databases. And the file size increate very fast when operating with ContentProvider. It occupied user RAM space too much. It is recommended to close the SQLiteOpenHelper to solve my problem (it is useful) in post enter link description here . But I want to find a "place" to add the "close()" method since I am not using SQLiteOpenHelper directly (using through

Logic code reuse between apps for Android and other platforms: To ContentProvider or not to ContentProvider?

随声附和 提交于 2019-11-28 08:15:35
问题 I'm developing an app which I want to make available both for Android and Blackberry (possibly to JavaME in the future). The business logic will be common to all the platforms - and hence, so will the corresponding layer in code. But I also have a data layer - which will obviously be different to the various platforms. My approach to this is to have a bean and an abstract DataStore class. If I were using Android's NotePad sample, it would look like this: Note Bean: public class Note { private

Download image from new Google+ (plus) Photos Application

风流意气都作罢 提交于 2019-11-28 08:03:39
Recently Google added the Photos app for Google+ (plus) and it shows up when you launch an Intent to choose an image. However, if I select an image from Google+ Photos and try to use it in my application none of my current logic is able to return a usable URI or URL to actually get an image that I can download and manipulate. I'm currently using the "common" methods to try to manipulate the URI that can be found here on Stack Overflow and elsewhere. I can provide code if needed, but at this point I think it's kind of irrelevant since it works well for everything else except this new app. Any

IllegalArgumentException: the bind value at index 1 is null

半世苍凉 提交于 2019-11-28 07:54:22
Does anybody know what this means? 12-31 20:55:45.861: ERROR/AndroidRuntime(12478): Caused by: java.lang.IllegalArgumentException: the bind value at index 1 is null 12-31 20:55:45.861: ERROR/AndroidRuntime(12478): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:234) 12-31 20:55:45.861: ERROR/AndroidRuntime(12478): at android.database.sqlite.SQLiteQuery.bindString(SQLiteQuery.java:182) 12-31 20:55:45.861: ERROR/AndroidRuntime(12478): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:48) 12-31 20:55:45.861: ERROR/AndroidRuntime(12478):

IllegalArgumentException: Invalid column

守給你的承諾、 提交于 2019-11-28 07:29:09
问题 Here is the logcat: 01-15 16:06:03.622: ERROR/AndroidRuntime(22300): Uncaught handler: thread main exiting due to uncaught exception 01-15 16:06:03.657: ERROR/AndroidRuntime(22300): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mohit.geo2do/com.mohit.geo2do.activities.TaskEdit}: java.lang.IllegalArgumentException: Invalid column due_date 01-15 16:06:03.657: ERROR/AndroidRuntime(22300): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) 01-15