NoobProgrammer
NoobProgrammer

Reputation: 35

Android to store data in sqllite

I currently make one android apps.I manage to the registration and login then direct user to the main page.How to link the inserted data to the currently login user.should I create the new table for the value inserted.all the element in the main page is also done.but the problem is that when user insert data in the main page..how i connect the inserted data to the user that currently login..and how is it work in the database(sqllite)..do i just use the table that previously registerd user used..or create new one to store data inserted in the main page just nw.

Upvotes: 0

Views: 121

Answers (2)

Nilesh Patel
Nilesh Patel

Reputation: 46

Add Additional column user_Status in Previously used Table by ALTER TABLE,

private static final String DATABASE_INSERT_COULMN = "ALTER TABLE TableName ADD COLUMN user_Status string;";

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // If it is new version add coulmn in previous table
    if (newVersion > oldVersion) {
        db.execSQL(DATABASE_INSERT_COULMN);
    }  
}

Upvotes: 0

Md. Arafat Al Mahmud
Md. Arafat Al Mahmud

Reputation: 3214

Just use the table that previously registered user used with a simple modification. Add a column which stores the logged in status of the user.

Upvotes: 2

Related Questions