contentprovider

Unknown URL content:Unknown URL content:\com.mohit.provider.FormulaProvider\formulas

I get this error everytime I try to use my content provider to insert a URI. Here is the method: private void sample() { ContentValues values; values = new ContentValues(); values.put(Formulas.TITLE, "Formula1"); values.put(Formulas.FORMULA, "someformula"); getContentResolver().insert(getIntent().getData(), values);...

Could someone explain SQLiteOpenHelper getType

I'm trying to implement a database in my application. I'm following a tutorial about writing my own ContentProvider, but I'm confused about SQLiteOpenHelper::getType. We're supposed to write it and, essentially, write a switch that returns the MIME type corresponding to the type of data we're dealing with. I don't fully understand it....

Can one use the Android ContentProvider to serve up an http response (non DB)?

I would like to provide the appearance of DB for my web service without storing it into the DB as a cache or middleware. ...

Extended ContentProvider not behaving properly

I'm trying to implement a ContentProvider wrapped around an SQLite database. I've followed the tutorial here in building my ContentProvider: tutorial I want to test what I have; so I'm attempting to instantiate my new ContentProvider, retrieve a Cursor from the query handler, and attach it to my CursorAdapter. Currently, I'm doing th...

CursorIndexOutOfBoundsException caused by Uri

Here is my LogCat log: 08-25 22:35:27.989: ERROR/AndroidRuntime(327): Caused by: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 3 Here is the onCreate(Bundle) method where I get the cursor: private static final String[] PROJECTION = { Formulas._ID, Formulas.TITLE, Formulas.FORMULA }; @Ove...

Database calls in services

I've been watching Virgil's presentation at the Google I/O on REST-heavy applications. Google I/O 2010 - Android REST client applications Though the notepad tutorial makes database calls directly from the UI layer, Virgil suggests making database calls in a Service. At the moment, my Activity's onCreate method uses an extended Content...

Conflicting content providers

Hello, I am developping an application using a ContentProvider. It is declared in the manifest : <provider android:name="foor.bar.FooBarProvider" android:authorities="foo.bar.FoorBarProvider" /> Everything is working fine, I can access the provider. The problem is that I want to create a demo version of my app and I want it ...

When to delete a temporary file used in Intent.SEND for attached email?

We generate a temporary file on an Android device and attach it to an email. We use a custom Content Provider to feed that file to the email application. The problem is that the email application access the file many times, instead of once, until it finally sends the email (for example, every time it writes a draft we get a request). Th...

managedQuery always returns the same result

In my onItemClick method I have: public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Uri formula = ContentUris.withAppendedId(Formulas.CONTENT_URI, id); Cursor formulaCursor = managedQuery(formula, PROJECTION, null, null, null); formulaCursor.moveToFirst(); searchBar.setText(formulaCursor...

New to Android. Is it possible for the user to specify the name of a Database to be created? Also on using multiple databases.

Hi everyone. I'm very new to Android. I'm thinking about creating an application that uses multiple databases. The user would be able to specify the name of the database to be created, and select which database to use from those existing in the /databases/ directory. Is this possible in android? ...

Where on android.git.kernel.org can I find the source for such classes as Activity, Intent, and ContentProvider?

Not sure how to figure out which android project on android.git.kernel.org corresponds to the classes extended in some of the app examples in the SDK such as Activity, Intent, and ContentProvider. ...

How to trigger creation of coverart-cache files in android

Hi, i have a small application that uses a query on android.provider.MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI to get all available albums and their respective covers. The problem is, that the coverart is only initialized, if the corresponding tracks are played first in e.g. the music-application. Is there a way for me to initializ...

Android ContentResolver: Pass the data with cursor without requery or get the exact executed cursor when querying from activity

Say, I'm having a ContentProvider (which in fact do not performs database call) and I want to pass some additional data (for example, call statistics) with the cursor to the caller: public class SomeProvider extends ContentProvider { . . . public Cursor query(....) { // I can not set extras for cursor here ...

How to query Android MediaStore Content Provider, avoiding orphaned images?

I'm trying to provide an in-app Activity which displays thumbnails of photos in the device's media store, and allow the user to select one. After the user makes a selection, the application reads the original full-size image and does things with it. I'm using the following code to create a Cursor over all the images on the external sto...

Querying Android db for specific piece of data

I'm creating a method that will see if a column in a database row is populated; and if so, it returns the varchar in that row, else it calls a web service to return that data. My question is: What is the standard way of simply selecting a column with Android? (select mycolumn from mytable where _id = x;) I've created a ContentProvider...

UriMatcher handing back wrong value

I have two Uris. Suppose they are: content://myprovider/messages content://myprovider/messages/# In my extended ContentProvider I have declared the following: private static final int MESSAGES = 1; private static final int MESSAGES_ID = 2; private static final UriMatcher sUriMatcher; static { sUriMatcher = ...

Is it possible to mock the sqlite3 Cursor in Android when no db or table exists?

I am using a ContentProvider for caching results from a web-service query. It is an HTTP request and the response content is XML. Most of the data is cached, so I simply query the DB, if not found, request from webservice, insert in DB and requery the DB. Thus the response is always a Cursor from SQLiteDatabaseHelper. I have one resu...

How can i send image without storing in sdcard?

I am developing an application that displays images. The application provides an option to email the image as an attachment. I have to save the image to the SD card in order to email the image as an attachment. Is it possible to email the image as an attachment without writing it to the SD card first? ...

Does Android's CursorAdapter run in a background thread?

Does the CursorAdapter run on a background thread and posts updates via the UI looper thread? If not what is the best pattern to load data asynchronously from a ContentProvider? ...

Android SMS handling

Hello, I am just wondering about how android handles sms when it receives them. More precisely my question is when the android phone receives a sms message, which application saves the message to the mmssms database? Is this done by the OS or by the native sms application? ...