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.net.Uri;
import android.text.*;
import android.util.*;


public class SplitProvider extends ContentProvider {
public static final Uri CONTENT_URI = Uri.parse("content://
com.Split.ourfirstandroidapp.provider.friend/friends");
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",
FRIENDS);
uriMatcher.addURI("com.Split.provider.friend", "friends/#",
FRIENDS_ID);
}


//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);
}

@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DATABASE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, "Upgrading database from version " +
oldVersion + " to
"+ newVersion
+ ", which will destroy old data");
db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
onCreate(db);
}
}
//nested helper class end!

@Override
public int delete(U



Other Threads

1. Pause music player on a phone call and again resume it after phone call

hello..

i am using android.media.MediaPlayer object to play audio files in my
app.everything works fine but when a phone call comes while a song is
playing, app does not pause the media player and you can hear the song
during the phone call.Please tell me how to pause media player on a
phone call and again resume it after call is ended.

-- 

2. Unable to install the Android 2.0 SDK

Hi All,

I am unable to install the Android 2.0 in my system.
If i try to update the platform using Android SDK and AVD Manager, i
am getting the following error.
""Failed to fetch URL 
https://dl-ssl.google.com/android/repository/repository.xml,
reason: No route to host: connect". I tried using http connection
also. Same issue is observed. Can you pls any one help on this

-- 

3. Error: Error parsing the sdk.

4. How to use AUDIO_SERVICE ?

5. Collection of ADC2 App Winner APK Pac

6. GK : How to Use Android Open source Platform code

7. Is there any posibility to know the size of the video file?