Guest User

Untitled

a guest
Aug 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. public void viewContact(){
  2. String name = getIntent().getStringExtra("name").toString();
  3. tvName.setText(name);
  4.  
  5. String phone = db.getContacts(name).toString();
  6. tvPhone.setText(phone);
  7.  
  8. String web = db.getContacts(name.toString();
  9. tvWeb.setText(web);
  10. }
  11.  
  12. public Cursor getContacts(String therapist_name){
  13. String selectQuery = " SELECT therapist_phone, therapist_web " +
  14. " FROM " + THERAPIST_TABLE + " WHERE " + THERA_NAME + " = " + "'" + therapist_name + "'";
  15. SQLiteDatabase db = this.getReadableDatabase();
  16. Cursor cursor = db.rawQuery(selectQuery, null);
  17.  
  18. return cursor;
  19. }
  20.  
  21. Cursor cursor = db.rawQuery(selectQuery, null);
  22. if (cursor != null) {
  23. if (cursor.moveToFirst()) {
  24. do {
  25. //Save data in variables here
  26. ph_no = cursor.getString(0); // therapist contact
  27. web = cursor.getString(1); //therapist web
  28. } while (cursor.moveToNext());
  29. }
  30. }
  31. //pass an array of ph_no and web from here now
Add Comment
Please, Sign In to add comment