mardi 28 juillet 2015

How to insert data into SQLite for Android Studio

I was looking at a tutorial and it created my database perfectly. But I'm not sure if inserting the data from the tutorial is outdated or something because I can not get my data to insert in my table. This is how the tutorial is telling me to add the data. But its not working. Anything other ideas?

private void createData(){
    Meters meters=new Meters();
    meters.setAcctno(*****);
    meters.setMeterno(*****);
    meters.setCustname("******");
    meters.setAddress("********");
    meters.setCity("*****");
    meters.setState("*****");
    meters.setZip(*****);
    meters.setContname("*****");
    meters.setPhoneno("******");
    meters =datasource.create(meters);
    Log.i(LOGTAG, "Meters created with id " + meters.getMetersid());

Aucun commentaire:

Enregistrer un commentaire