android-contentprovider

how to get contact photo URI

廉价感情. 提交于 2019-11-27 08:56:50
I am working with Android Contact ContentProvider. I have a Phone Number and I need to get the URI of the Photo of the contact associated with this phone number. How can I do it??? I know I can get the raw data of the photo and build an InputStream , but I dont want the input stream, I need the URI . EDIT: Originally I'm using following code to fetch contact info Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNo)); Cursor cursor = context.getContentResolver().query(uri, details, null, null, null); To get the conatct id using the phone number use the following

Explicitly saving new messages to inbox

北城余情 提交于 2019-11-27 08:19:04
问题 Question regarding content://sms/inbox : 1) Is it advisable to explicitly store incoming messages to inbox? 2) What if an android device has a native messaging app and my messaging app was installed to it, and then I explicitly store incoming messages to inbox, will the messages duplicate? 3) Does android automatically store new messages to inbox regardless if there is a messaging application? Thanks. 回答1: Regarding SMS, details vary depending on the Android version. Prior to KitKat, the SMS

android: EXDATE format when adding a calendar event

喜你入骨 提交于 2019-11-27 06:55:18
问题 Can someone explain how to use EXDATE when adding event to android calendar? The documentation is pretty unclear about the format in which the EXDATE should be put. I tried many formats, these are some of them: values.put(Events.EXDATE, "TZID=Europe/London:20130116T080000"); values.put(Events.EXDATE, "20130116T080000Z"); values.put(Events.EXDATE, "20130116T080000"); values.put(Events.EXDATE, "20130116"); but none of them works. Any idea how to make an event not appear on a particular date, if

How to check database on not rooted android device

走远了吗. 提交于 2019-11-27 06:34:43
I am developing an app where i am using sqllite3 database to store values. I have Nexus S and Nexus 7 both are unrooted devices. How can i get the database for my app for debugging purpose. I have tried (1) I have tried all approach mentioned here adb shell run-as app.package.name \ cp /data/data/package.name/databases/application.sqlite /sdcard/ exit adb pull /sdcard/application.sqlite ~/ This says cp not found.. (2) http://developer.android.com/tools/help/adb.html#sqlite adb -s emulator-5554 shell # sqlite3 /data/data/com.example.google.rss.rssexample/databases/rssitems.db SQLite version 3.3

Android - How can I pass data related to two tables to a the insert method of a Content Provider

久未见 提交于 2019-11-27 06:28:31
问题 I need to insert data related to an Order and its corresponding Detail . Without a ContentProvider I would do something like this: public boolean insertOrder(Order order, ArrayList<OrderDetail> items) { boolean wasSuccessful = false; ContentValues cvOrder = new ContentValues(); cvPedido.put(ORDER_CUSTOMER_ID, order.getCustomerId()); cvPedido.put(ORDER_CUSTOMER_NAME, order.getCustomerName()); String insertQuery = "INSERT INTO " + ORDER_DETAIL_TABLE + " VALUES (?,?)"; //... try { this

What are the semantics of withValueBackReference?

左心房为你撑大大i 提交于 2019-11-27 06:10:37
I cannot figure out the exact semantics of withValueBackReference . I've read the example code (for example the code which adds a new contact) using this method, providing a backReference value of 0. What does this mean? The documentation says: A column value from the back references takes precedence over a value specified in withValues(ContentValues) Merlin This question relates to batch operation on a content provider. The example is modified from this related question . When creating a batch of operations first create a list of operations to perform using: ArrayList<ContentProviderOperation

Android: call custom methods in a ContentProvider

人盡茶涼 提交于 2019-11-27 05:57:48
问题 I have a custom ContentProvider I use to store fixes obtained from the GPS into a SQLite database. This class overrides ContentProvider methods (delete, insert, query...), but notice I have also included a method to query the last fix. public class FixesContentProvider extends ContentProvider { @Override public int delete(...) { ... } ... @Override public Cursor query(...) { ... } public Cursor getLastFix(Uri uri) { ... } } It is pretty easy to query data from other services or activities by

Android. Content provider or Database?

倖福魔咒の 提交于 2019-11-27 05:32:55
问题 I'm a bit confused in the question, if it's better to use ContentProvider or Database . Or it makes no difference if I don't want to share any data with other applications. If I've understood it right, content providers based on SQLite DBs and it's also possible that content of them is only accessable for my application. Can you give some explanations? Thank you very much, Mur 回答1: There certainly are worthwhile problems for which a provider is a solution, particularly for cross-app data

Getting an image from Gallery on from the Picasa//Google + synced folders doesn't work

拜拜、爱过 提交于 2019-11-27 05:32:08
问题 I am trying to get an image from the gallery app from one of the folders from the Google+ synced photos. After selecting the image, the Uri is being passed back correctly. But when I try to get the actual path of that image on the storage device, so that I can use it, it crashes. The problem seems to be specifically with the picasa content provider . Tested on Nexus S and Nexus 7, and other devices as well. E/AndroidRuntime(14572): java.lang.RuntimeException: Failure delivering result

Exact Difference between “Content-Provider” and “SQLite Database”

耗尽温柔 提交于 2019-11-27 04:10:23
问题 i have done SQLite database programming for Android, but i dont know anything about Content-Provider except this: "As i have referred Android Developer page , Android SDK explained about "Content-provider" as it is used to store and retrieve data." But then, What is the exact difference between "Content-Provider" and "SQLite Database"? Which is best to store data, when ? Any example or helps !! 回答1: I found one major difference, as follows: Storing your data in a database is one good way to