I have 2 text field user name and password and a button in same view I filled these two text box and click the submit button for inserting the data in the data base, but it is failed for inserting in sqlite data base I am also pasting my Log cat below. Please take a look where is the problem: why it is not inserting it database? Thanks.
public class MyContentProvider extends ContentProvider {
public static final String USER_NAME = "USER_NAME";
public static final String PASSWORD = "PASSWORD";
private SQLiteDatabase sqlDB;
public DatabaseHelper dbHelper;
private static final String DATABASE_NAME = "Users.db";
private static final int DATABASE_VERSION = 1;
private static final String TABLE_NAME = "User";
private static final String TAG = "MyContentProvider";
public static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
ava:150)
06-30 12:22:49.622: ERROR/JavaBinder(235): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:140)
06-30 12:22:49.622: ERROR/JavaBinder(235): at android.os.Binder.execTransact(Binder.java:287)
06-30 12:22:49.622: ERROR/JavaBinder(235): at dalvik.system.NativeStart.run(Native Method)
06-30 12:22:55.271: DEBUG/dalvikvm(235): GC freed 542 objects / 51288 bytes in 152ms
You have to store the password as text, ‘PASS’ doesn’t exist in sqlite, so there is probably some error when creating the table. Try this:
If you don’t want to store the password in a readable format you will obviously have to encrypt it first.