Guest User

Untitled

a guest
Nov 21st, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. public boolean insetTheme(String name2,String Description){
  2. SQLiteDatabase Mydb =this.getWritableDatabase();
  3. ContentValues newThingAdd = new ContentValues();
  4. newThingAdd.put(COL2_ALLTHEMES,name2);
  5. newThingAdd.put(COL3_ALLTHEMES,Description);
  6. long result = Mydb.insertOrThrow(TABLE_ALLTHEMES,null,newThingAdd);
  7.  
  8. Cursor res = Mydb.rawQuery("select * from "+TABLE_ALLTHEMES + " where 'ID2'" ,null);
  9. //res.moveToLast();
  10. if (res != null) {
  11. res.move(-1);
  12. }
  13.  
  14. ContentValues newThingAdd123 = new ContentValues();
  15. newThingAdd123.put(COL2_CURRENTTHEMES,name2);
  16. newThingAdd123.put(COL3_CURRENTTHEMES,Description);
  17. newThingAdd123.put("ID3",res.toString());
  18. long result2 = Mydb.insertOrThrow(TABLE_CURRENTTHEMES,null,newThingAdd123);
  19.  
  20. if ((result==-1)&(result2==-1))
  21. return false;
  22. else
  23. return true;
  24. }
Add Comment
Please, Sign In to add comment