dimanche 14 février 2016

SQlite store in Android

Hello I have problem to stored information into table. steps:

  1. 1.Create my table via SQlite Manager

           table name: User
           iduser      1
           username    user
           password    pass
    
    
    1. copy this table into assets folder (android studio)

      3.create class to control Database (DBAdapter 1)OnCreate , 2) OnUpgrade) 3)saveuser 4)checkuser

Always work correct, at run time without any error. Only problem is that when i enter username and password to log in to the application (means that check online server if the user exist) , and when check it online and exist in Server then store locally to the smart phone using SQlite.

But when i check it if the username and password are stored, there is not information. could anyone to give your idea whats going on ?

This is code to call to save user :

  public long saveUser(int idus, String id, String pwd) {

        ContentValues  cValues = new ContentValues();
        cValues.put("iduser", idus);
        cValues.put("username", id);
        cValues.put("password", pwd);

        // insert data into database
       return db.insert(DATABASE_TABLE, null, cValues);

    }

Aucun commentaire:

Enregistrer un commentaire