Guest User

Untitled

a guest
Jul 1st, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. @Override
  2. public int getIDmax() {
  3. int MAX =0;
  4. SQLiteDatabase db = this.getReadableDatabase();
  5. try{
  6. String QUERY = "SELECT MAX(KEY_MESSAGE_ID) AS KEY_MESSAGE_ID FROM "+TABLE_NAME ;
  7. Cursor cursor = db.rawQuery(QUERY,null);
  8. MAX =cursor.getColumnIndex(KEY_MESSAGE_ID);
  9. db.close();
  10. return MAX;
  11.  
  12. }catch (Exception e){
  13. Log.e("error",e+"");
  14. }
  15. return 0;
  16. }
  17.  
  18. int b = handler.getIDmax();
  19. Toast.makeText(getApplicationContext(),""+b,Toast.LENGTH_LONG).show();
Add Comment
Please, Sign In to add comment