HELP! Content Provider Issues

by Jaime » Sat, 08 May 2010 12:18:18 GMT

Sponsored Links
 i Everyone,

I am writing program for which I am creating my own ContentProvider. I
want a database of people (by name) and the debt that they owe to the
user (it's an app to keep track of debt). However, it is refusing to
run. I have posted below the ContentProvider that I use. The Activity
class that calls on this provider and the manifest. But no luck in
getting it run. Any ideas?

Here is the ContentProvider:

package com.Split.ourfirstandroidapp;

import android.content.*;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.*;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.text.*;
import android.util.*;

public class SplitProvider extends ContentProvider {
public static final Uri CONTENT_URI = Uri.parse("content://
private SQLiteDatabase splitDB;
private static final String TAG = "SplitProvider";
private static final String DATABASE_NAME = "split.db";
private static final String DATABASE_TABLE = "friends";
private static final int DATABASE_VERSION = 1;

//Column names
public static final String KEY_ID = "_id";
public static final String KEY_NAME = "name";
public static final String KEY_DEBT = "debt";

//Column indices

public static final int NAME_COLUMN = 1;
public static final int DEBT_COLUMN = 2;
//URI request handles
private static final int FRIENDS = 1;
private static final int FRIENDS_ID = 2;

private static final UriMatcher uriMatcher;

static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI("com.Split.provider.friend", "friends",
uriMatcher.addURI("com.Split.provider.friend", "friends/#",

//nested helper class start
private static class SplitDatabaseHelper extends SQLiteOpenHelper{
private static final String DATABASE_CREATE =
"create table" + DATABASE_TABLE + " ("
+ KEY_ID + " integer primary key autoincrement, "
+ KEY_NAME + " TEXT, "
+ KEY_DEBT + " INT)";

public SplitDatabaseHelper (Context context, String name,
CursorFactory factory, int version){
super(context, name, factory, version);

public void onCreate(SQLiteDatabase db) {
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, "Upgrading database from version " +
oldVersion + " to
"+ newVersion
+ ", which will destroy old data");
//nested helper class end!

public int delete(U

Other Threads

1. Windows Phone and XNA. Nightmare is real. What we do with that ?


At my daily job I work as WinMo C++ developer, so I had enough time to
become hater of that platform ;)

But now, M$ is coming with new Windows Phone. As I suspected, they
will abandon awful Win32/MFC native coding and all applications, will
be now managed - run in CLR sandboxes on top of 15 years old Win32

Main coding language will be C#  with .NET framework - Java rival.

WinMo always was terrible phone OS, but now, more interesting is, that
Windows Phone will support XNA framework:


This is full {*filter*} framework with C# interfaces and support for 2D/3D
graphics, animation, sprites, net play, game sound, controllers, etc..
XNA greatly improves creating games, because it gives a developer an
ready to use game abstraction layer.

To the point; Android needs game framework, like XNA. Maybe it should
be written as NDK library, ready to link with your own application.
This library could load, manage and draw sprites, backgrounds, make
simple physics, etc..

Why ? To create games faster, easier. At this time, you must be very
skilled to create simple platformer with 2 bkgs and 5 sprites. Our
devices have even 1GHz CPU's and animation can be STILL too slow ! I'm
tired of the same logical bricks/ball/falling diamonds games over and

What do you think ?

Is there any chance, that Google will work on something like that ?


2. Best practice to test what happens when my application is killed


I'm having troubles with users that report that if they leave the
application opened and after a few hours when they return to it the
app crashes. I'm pretty sure it is because I'm not storing/restoring
the status correctly when my process is killed by the system, but I
would like to be able to test it in a repeatable way.

Which is the best way to simulate the same behaviour that happens when
Android kills my process on low memory conditions? (killing the
process from the DDMS view, sending a signal from the adb, ...)


Jose Luis


3. reading serial data from the USB port.

4. Question about creating a thumbnail (more than one thumbnail for one image, avoiding problems with other Gallery-like apps)

5. Howto:read configured networks and display WPA-PSK as String

6. Menus :)

7. welcome... Android ?