i want to add some data inside my database .. i want to add the "admin" as default username and password for my program .. so that no need to register on first run of my program when i input username and password to my ediitext it will continue to go inside the admin activity..
this my coding to add some data
UserCrud uCrud = new UserCrud(this);
User user = new User();
user.loguser = "admin";
user.logpass = "admin";
uCrud.insert(user);
this my crud operation to insert data inside my database public class UserCrud {
private DBHelper dbHelper;
public UserCrud(Context context){
dbHelper = new DBHelper(context);
}
public int insert(User user){
SQLiteDatabase db = dbHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(User.KEY_priv, user.privl);
values.put(User.KEY_username, user.username);
values.put(User.KEY_usertype, user.usertype);
values.put(User.KEY_sex, user.sex);
values.put(User.KEY_usercompany, user.usercompany);
values.put(User.KEY_usermail, user.usermail);
values.put(User.KEY_usercontact, user.usercontact);
values.put(User.KEY_useradd, user.useradd);
values.put(User.KEY_loguser, user.loguser);
values.put(User.KEY_logpass, user.logpass);
values.put(User.KEY_logconfirm, user.logconfirmm);
long user_Id = db.insert(User.TABLE, null, values);
db.close();
return (int) user_Id;
}
but when i run my app nothing happens ..
Aucun commentaire:
Enregistrer un commentaire