안녕하세요 어플개발 이제막 시작한 초보입니다.
어렵게 인터넷 검색하면서 DB연동해서 내용 가져오는것까지 했는데요..
지금은DB내용을 다 listeview에뿌려주는 원하는값만 가져오고싶거든요
DB가 이름 핸드폰번호 이렇게 되어있으면 이름검색해서 그에 해당하는 핸드폰 번호를 가져오고 싶어요.. 그걸 어떻게 해야하는지 모르겠는데 알려주세요..!
이소스로 listview에뿌리고있어요.ㅁ
protected void showList(){
try {
JSONObject jsonObj = new JSONObject(myJSON);
peoples = jsonObj.getJSONArray(TAG_RESULTS);
for(int i=0;i<peoples.length();i++){
JSONObject c = peoples.getJSONObject(i);
String No = c.getString(TAG_No);
String name = c.getString(TAG_NAME);
String phone = c.getString(TAG_phone);
HashMap<String,String> persons = new HashMap<String,String>();
persons.put(TAG_No,No);
persons.put(TAG_NAME,name);
persons.put(TAG_phone,phone);
personList.add(persons);
}
ListAdapter adapter = new SimpleAdapter(
ActivityDB.this, personList, R.layout.list_item,
new String[]{TAG_No,TAG_NAME,TAG_phone},
new int[]{R.id.no, R.id.name, R.id.ph}
);
list.setAdapter(adapter);
} catch (JSONException e) {
e.printStackTrace();
}
}