private ArrayList<Patients> convertListToPatients(ArrayList<Object> o) { ArrayList<Patients> pList = new ArrayList<Patients>(); Iterator<Object> i = o.iterator(); Patients p; Object obj_item; while (i.hasNext()) { p = new Patients(); obj_item = i.next(); if (obj_item instanceof Patients) { p = (Patients) obj_item; pList.add(p); } } for (Patients item : pList) Log.d("DataCheck", item.toString()); Log.d("DataCheck", "Number of Records Retrieve: " + pList.size()); return pList; }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; final Patients patients = (Patients) getListAdapter().getItem(info.position); // Toast.makeText(getActivity(), "Full Name of Clicked: "+patients.getId(), // Toast.LENGTH_LONG).show(); // final Patients patients = (Patients) help.getRecord(PATIENTS, id.getText().toString()); MenuItem edit = menu.add("Edit"); MenuItem delete = menu.add("Delete"); if (patients != null && patients.getPat_status() == 1) { Log.d("itemCheck", "Patient ID: " + patients.getPatient_id()); Log.d("itemCheck", "Patient Name: : " + patients.toString()); help.getPatientSchedule(patients); Log.d("itemCheck", "Schedule ID: " + patients.getSchedule_id()); Log.d("itemCheck", "Location : " + patients.getLocation()); Log.d("itemCheck", "Hospital Name: " + patients.getHosp_name()); Log.d("itemCheck", "Hospital Room: " + patients.getHosp_room()); Log.d("itemCheck", "Time: " + patients.time()); Log.d("itemCheck", "Request Code: " + patients.getRequestCode()); Log.d("itemCheck", "Under this Schedule is: Patient Name: " + patients.toString()); Log.d("itemCheck", "Under this Schedule is: Medical History: " + patients.getMed_history()); MenuItem update = menu.add("Update Rounds Schedule"); update.setOnMenuItemClickListener( new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { updateRounds(patients); return true; } }); } MenuItem change_status = menu.add("Change Status"); change_status.setOnMenuItemClickListener( new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { changeStatus(patients); return true; } }); edit.setOnMenuItemClickListener( new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { editPatients(patients); return true; } }); delete.setOnMenuItemClickListener( new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { deletePatients(patients); return true; } }); }