0
contactmanager.java목록보기 안드로이드에서 이름을 클릭하여 상세 정보를 표시하는 방법?
protected void onListItemClick(ListView l, View v, int position, long id)
{
super.onListItemClick(l, v, position, id);
Intent i = new Intent(this, ContactEditor.class);
String projection = new String(ContactsContract.Contacts._ID);
i.putExtra(projection, ContactsContract.Contacts._ID);
startActivityForResult(i, 2);
}
ContactEditor.java 내가 ContactManager.java 에서 목록보기에서 선택한 이름으로 mContactNameEditText (글고 치기)를 채우는 방법을 잘 모릅니다
private void populateFields(){
if (mRowId != null)
{
Cursor address = mDbHelper.fetchContact(mRowId);
startManagingCursor(address);
mContactNameEditText.setText(address.getString(address.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME)));
mContactPhoneEditText.setText(address.getString(address.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.NUMBER)));
}
}
public Cursor fetchContact(long rowId)throws SQLException
{
Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);
if (cursor != null)
{
cursor.moveToFirst();
}
return cursor;
}
연락처 세부 정보를 얻기위한 또 다른 방법이 , : listview에서 이름을 클릭하여 이름, 전화 번호 등?
http://stackoverflow.com/a/10107068/1289716 – MAC