android-contentprovider

Search Suggestion results displayed as blank/no text

非 Y 不嫁゛ 提交于 2019-12-05 13:15:55
问题 I have included a Search Dialog in my Activity which works fine. However adding Search Suggestions gives me a little problem: The search suggestion entries are "empty". I can see my content provider gets called (query(..)) and I return a MatrixCursor with several rows. The suggestions list also shows with (clickable) entries -- but are all blank. Blank as if the string I returned for SUGGEST_COLUMN_TEXT_1 and SUGGEST_COLUMN_TEXT_2 where an empty string. The columns I use in the MatrixCursor

Why should I use custom content provider in Android?

允我心安 提交于 2019-12-05 12:37:23
What are advantages of using custom content provider? Why such content provider is superior of plain class that wraps SQL queries? Content providers can be used from other processes and are required by some mechanisms on Android like the global search. There are also some classes available that help you deal with content providers that save you some of the hassle of manging memory. Other apps will be able to access your data. You can wrap and abstract a lot of the query logic in your content provider, and limit access. You will be able to lean on the system to allow for things like managed

Access UserDictionary Content Provider on android API level 23

自闭症网瘾萝莉.ら 提交于 2019-12-05 10:32:28
I'm developing a android application which aims to show a list on the screen with the contents present in the user dictionary. The problem is that when I compile and run the application in the Android API Level 23 Content Provider return a Cursor with no item, without any data. It's strange because the API's preceding 23 (22, 21, 19, ...) the app runs and displays the data in the ListView normally. Below is the code of my Activity: import android.app.LoaderManager; import android.content.CursorLoader; import android.content.Loader; import android.database.Cursor; import android.provider

Android content provider update certain columns

自古美人都是妖i 提交于 2019-12-05 08:27:26
I am trying to make an android application that will identify how much time is left for a task to be completed. I have followed Vogella's tutorial, particularly this part http://www.vogella.com/articles/AndroidSQLite/article.html#todo to make a contentprovider and database. It populates a listview with two things, the name of the task and how many days are left (the latter is calculated when the user selects his end date in another activity). My app calcualtes the current date and subtracts it from the end date and stores how many days are left in the database. The problem is that this is only

android content provider sum query

[亡魂溺海] 提交于 2019-12-05 07:07:44
Is it possible to use getContentResolver().query() when I want sum(column) ? OR Do I have to make raw query to db handle? When providing the array of columns to ContentResolver.query , wrap the column name with the sum() function String[] columns = new String[] { "sum(" + columnName + ")" }; Cursor cursor = getContentResolver().query( content_uri, columns, selection, selectionArgs, sort ); cursor.moveToFirst(); int columnSum = cursor.getInt(0); Rahul OK, it seems that its not possible using getContentResolver().query() . I had to get db connection and make rawQuery . ContentProviderClient

Android: ParcelFileDescriptor “createpipe” method 64KB error

梦想与她 提交于 2019-12-05 07:01:43
问题 I have an app that uses the ContentProvider class. In the openFile method, I need to be able to decode a file & return as a stream of data. So I decided to use the built in pipe. The problem is If I use the createPipe method, I am able to write only 64KB into it. After that I am unable to write data into the Pipe. Also note that I cannot read until the data is fully decoded & written into the pipe. package com.aujas.html.viewer.content; public class LocalFileContentProvider extends

Class structure for a ContentProvider having multiple sub tables

无人久伴 提交于 2019-12-05 06:45:15
问题 The ContentProvider doc says to make ONE entry in the AndroidManifest for your ContentProvider class. If your class supports multiple sub-tables then there must be one CONTENT_URI constant declared for each. How? You can't do that unless you sub-class for each sub-table. Why not just have multiple providers? Do you implement the sub-table providers as descendants? With multiple sub-tables, there is still only ONE ContentProvider class? As you can see, I'm confused by the documentation. It

Using ContentResolver instead of ContentProviderClient in SyncAdapter

让人想犯罪 __ 提交于 2019-12-05 06:29:23
As I understand from the docs, one SyncAdapter defined in a SyncService is limited to receive only one ContentProvider authority to work on. But, at the same time, it has access to ContentResolver which it allows to run queries on other ContentProviders as well. I don't understand this particular design concept if a developer is needed to provide a single content authority to SyncAdapter and nonetheless she is able to do whatever she wants on whatever ContentProvider she has access to. My question is: What are the consequences of ignoring onPerformSync's parameters: String authority and

Dynamically set the authority of a ContentProvider

拥有回忆 提交于 2019-12-05 04:36:32
Perhaps the title is a bit misleading. My problem is that I have an Android library project which is shared between two standard Android projects: one for a free version of the app and the other for a paid version. The library currently has the code for a ContentProvider, including a contract class with several static String variables for things such as the URI and column names. Now I want the "authority" for the URI to change depending on which app is using the library. One solution that comes to mind is storing the authority as a string resource and loading that string at run-time into the

Android, content provider in library project

百般思念 提交于 2019-12-05 02:32:03
I have a library project providing the base code for a number of apps that all needs the same database structure and functionality and I'm looking for the best way to implement this. My main concern is really about how to provide a non static authority so I can override it with the package name of the app that uses the library. So in the library project I was thinking I could change the following constants to static methods that will accept a context that will allow me to get the authority from a resource string or from the context.getPackageName method library project model public static