android-contentprovider

android custom contentprovider

那年仲夏 提交于 2019-12-24 09:47:17
问题 I wrote custom contentprovider that creates a database in sqlite3 with single table 'user_authentication'. While the db and table have been created on their respective onCreate() methods, I am getting an NullPointerException in the overriden insert method . Below is the method: public Uri insert(Uri uri, ContentValues initialvalues){ SQLiteDatabase sqlitedb = dbHelper.getWritableDatabase(); if(sUriMatcher.match(uri)!= TABLE){ throw new IllegalArgumentException("Unkown Uri"+uri); }

android: EXDATE format when adding a calendar event

╄→гoц情女王★ 提交于 2019-12-24 08:48:43
问题 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

Content Provider w/ Cursor - Gets Killed (how to notify client)

醉酒当歌 提交于 2019-12-24 08:48:42
问题 I have a content provider in on apk which is providing Rest Based Search results for multiple client apps. Basically, the client requests a cursor via content resolver, then fires an intent service request to trigger the search.. In the provider, the cursor is returned to a table, and each intent service request populates the corresponding table, and triggers a NotifyDataSetChanged. Works really well.. The only issue I am having is that if the Provider is killed for some reason (tested by

Content Resolver Query is not finding music on sd-card

我们两清 提交于 2019-12-24 03:51:31
问题 I have constructed a simple query to find music on the sdcard of the Android emulator. I am using Android Studio. I placed 3 songs on the sdcard using adb push. However, the query is not finding the music files. Here is an image of the files on the sdcard in the Music folder: Here is the code that I am using to perform the query: ContentResolver musicResolver = getContentResolver(); Uri musicUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Cursor musicCursor = musicResolver.query(musicUri,

SQL timestamp does not change when UPDATE happens

[亡魂溺海] 提交于 2019-12-24 03:16:48
问题 I use the following SQL command to create a products table on an Android client. CREATE TABLE IF NOT EXISTS 'products' ( '_id' INTEGER PRIMARY KEY AUTOINCREMENT, 'name' TEXT, 'serverId' INTEGER, 'modifiedAt' TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNIQUE ( 'serverId' ) ON CONFLICT REPLACE ); When I load data from a server and insert it into the local database, I use the following commands in the content provider to either update a row or insert new values. public int bulkInsert(Uri uri,

SQL timestamp does not change when UPDATE happens

我的梦境 提交于 2019-12-24 03:16:06
问题 I use the following SQL command to create a products table on an Android client. CREATE TABLE IF NOT EXISTS 'products' ( '_id' INTEGER PRIMARY KEY AUTOINCREMENT, 'name' TEXT, 'serverId' INTEGER, 'modifiedAt' TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNIQUE ( 'serverId' ) ON CONFLICT REPLACE ); When I load data from a server and insert it into the local database, I use the following commands in the content provider to either update a row or insert new values. public int bulkInsert(Uri uri,

Pass a parameter to a Custom Search Suggestion ContentProvider

て烟熏妆下的殇ゞ 提交于 2019-12-24 03:07:51
问题 I have a working custom search suggestions class (via http://developer.android.com/guide/topics/search/adding-custom-suggestions.html). It currently returns one type of information - "product names". I've added some additional activities (screens) to my app so that if a person is on a product page, starting up a search should return results from "product names", but if they are in another activity, I would like the search suggestions to pull "manufacturer names". I saw Accessing appSearchData

why in the android developer guide the android:authorities is defined like this?

Deadly 提交于 2019-12-24 01:12:42
问题 Below is the notepad sample code, why the android:authorities = com.google.provider.NotePad instead of using the project package name? and what exactly is android:authorities asking for? Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License

Duplicated ContentValues in ContentValues array

让人想犯罪 __ 提交于 2019-12-24 00:18:35
问题 Can any help with this, sure it is something simple but can't see it. Doing a bulkInsert to content provider (UserDictionary) but all inserts have same "word" value. Issue is Array of ContentValues. This is some test code I have: public void mClick(View v){ int batchSize = 25; ContentValues[] mValueArray = new ContentValues[batchSize]; List<ContentValues>mValueList = new ArrayList<ContentValues>(); ContentValues mNewValues = new ContentValues(); mNewValues.put(UserDictionary.Words.APP_ID,

Android: Provider Test Case 2 and getFilesDir()

大兔子大兔子 提交于 2019-12-23 20:51:34
问题 Part of my application involves saving a png file to my local files directory, and then shared via a content provider. I write the file via getContext().openFileOutput However, in my content provider, ParcelFileDescriptor will only open actual File objects. So trying to do this via a mocked out content provider using ProviderTestCase2 , the following code doesn't work: return ParcelFileDescriptor.open(new File(getContext().getFilesDir(), filename), ParcelFileDescriptor.MODE_READ_ONLY) This is