Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public String searchAll (ArrayList<String> names, ArrayList<String> Email, ArrayList<String> Password)
  2. {
  3.  
  4. db = this.getWritableDatabase();
  5. Cursor cursor = db.query("contacts",null,null,null,null,null,null);
  6. if (cursor.moveToFirst())
  7. {
  8. int idColIndex = cursor.getColumnIndex("id");
  9. int nameColIndex = cursor.getColumnIndex("name");
  10. int emailColIndex = cursor.getColumnIndex("email");
  11. int passwordColIndex = cursor.getColumnIndex("password");
  12. do {
  13. names.add(cursor.getString(nameColIndex));
  14. Email.add(cursor.getString(emailColIndex));
  15. Password.add(cursor.getString(passwordColIndex));
  16. } while (cursor.moveToNext());
  17.  
  18. }
  19. cursor.close();
  20.  
  21. db.close();
  22.  
  23. }
  24.  
  25. SQLiteDatabase db = oh.getReadableDatabase();
  26.  
  27. Cursor cursor = db.query("data", new String[] { oh.KEY_ID,
  28. oh.KEY_METRIC, oh.KEY_ROOL },null,
  29. null, null, null, null, null);
  30. if (cursor != null)
  31. cursor.moveToFirst();
  32.  
  33. while (cursor!=null){
  34.  
  35. try {
  36. data.add(cursor.getString(2));
  37. cursor.moveToNext();
  38. }catch (Exception e){
  39. break;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement