Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void viewContact(){
- String name = getIntent().getStringExtra("name").toString();
- tvName.setText(name);
- String phone = db.getContacts(name).toString();
- tvPhone.setText(phone);
- String web = db.getContacts(name.toString();
- tvWeb.setText(web);
- }
- public Cursor getContacts(String therapist_name){
- String selectQuery = " SELECT therapist_phone, therapist_web " +
- " FROM " + THERAPIST_TABLE + " WHERE " + THERA_NAME + " = " + "'" + therapist_name + "'";
- SQLiteDatabase db = this.getReadableDatabase();
- Cursor cursor = db.rawQuery(selectQuery, null);
- return cursor;
- }
- Cursor cursor = db.rawQuery(selectQuery, null);
- if (cursor != null) {
- if (cursor.moveToFirst()) {
- do {
- //Save data in variables here
- ph_no = cursor.getString(0); // therapist contact
- web = cursor.getString(1); //therapist web
- } while (cursor.moveToNext());
- }
- }
- //pass an array of ph_no and web from here now
Add Comment
Please, Sign In to add comment