congrats!
I know after all this work, this is nothing!!
no primary key defined - generation correct
![](https://camo.githubusercontent.com/4fac7fd3ea272c5f0e816c2533c25096d7b4001a543f403329fe84bc28f04f5b/687474703a2f2f692e696d6775722e636f6d2f725a3368306b542e706e67)
primary key defined - generation dodgy
![](https://camo.githubusercontent.com/0b6407b636061f28d10bf0fba756a94183ec5668266538bf209cb3748ebf37d1/687474703a2f2f692e696d6775722e636f6d2f616a4947334b672e706e67)
![](https://camo.githubusercontent.com/50bd497025d6b1e370cef9dd9928ed0ebb9525c3e2616a7f4b8354f94dc7af19/687474703a2f2f692e696d6775722e636f6d2f7465516c4c49592e706e67)
![](https://camo.githubusercontent.com/06cdbc98ede0f698d28493efe9c8ddd4a2207a85dde5e528d04dc61e54e0d50d/687474703a2f2f692e696d6775722e636f6d2f6c59676d5359392e706e67)
hmm, what about create the table class (setters&getters) ?
then at ProviderClient we can have something like :
//Automotodetails the table class (setters&getters)
public static List<Automotodetails> getAllAutomotodetailss(Context c) {
List<Automotodetails> automotodetailss = new ArrayList<Automotodetails>();
Automotodetails automotodetails = null;
Cursor cursor = getAllTable(c);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
automotodetails = cursorToAutomotodetails(cursor);
automotodetailss.add(automotodetails);
cursor.moveToNext();
}
// Make sure to close the cursor
cursor.close();
return automotodetailss;
}
private static Automotodetails cursorToAutomotodetails(Cursor cursor) {
if (cursor == null || cursor.getColumnCount() == 0)
return null;
Automotodetails automotodetails = new Automotodetails();
automotodetails.setautomotodetail_id(cursor.getLong(0));
automotodetails.setautomoto_id(cursor.getLong(1));
automotodetails.setkm_daterec(cursor.getString(2));
automotodetails.setkm_counter(cursor.getLong(3));
automotodetails.setfixes(cursor.getString(4));
automotodetails.setcost(cursor.getDouble(5));
automotodetails.setwhere(cursor.getString(6));
automotodetails.setcomment(cursor.getString(7));
automotodetails.setautomotodetail_daterec(cursor.getString(8));
automotodetails.setautomotodetail_guid(cursor.getString(9));
return automotodetails;
}
on activity/fragment will work like :
List<Automotodetails> automotodetailss = AutomotodetailsContentProviderClient.getAllAutomotodetailss(this);
Toast.makeText(this, String.valueOf(automotodetailss.size()), 3000).show();
on create database better do in transaction (?)
@Override
public void onCreate(SQLiteDatabase db) {
Log.d(TAG, "Creating a new Database. Current version " + DATABASE_VERSION);
db.beginTransaction();
try {
db.execSQL(DATABASE_AUTOMOTODETAILS_CREATE);
db.execSQL(DATABASE_AUTOMOTOS_CREATE);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
forgot to add is primary key
tuning_id INTEGER --> PRIMARY KEY
on sqlitehelper create table variables
here need to be "item" ?
![](https://camo.githubusercontent.com/7d12350376c1592ee034a2dac8147c1a812a17d50c825fa98f29ac14389d8c42/687474703a2f2f692e696d6775722e636f6d2f6a52506c5041482e706e67)
where at delete/update procedures working like charm by UNIQUEID var!
still confused again with "_id"
what happening here ? how can be row query there ? I have to modify each with table_PK ?
![](https://camo.githubusercontent.com/717fdee172fb225a2f874cf5c96efa3b01b2254d969bfb74107d34d4a80a3fb4/687474703a2f2f692e696d6775722e636f6d2f72676b756f71512e706e67)
thanks!!!
updated
http://www.pipiscrew.com/works/sqlite-manager-v1-0/
v1.8.3 - generate table structure for Trikke โ android-sqlite-generator!