protected void onListItemClick(int position) {
   //		if (position != 0) {
   setResult(
       RESULT_OK,
       new Intent().putExtra("username", contactAdapter.getItem(position).getUsername()));
   finish();
   //		}
 }
Пример #2
0
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   if (item.getItemId() == R.id.delete_contact) {
     User tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
     // 删除此联系人
     deleteContact(tobeDeleteUser);
     // 删除相关的邀请消息
     InviteMessgeDao dao = new InviteMessgeDao(getActivity());
     dao.deleteMessage(tobeDeleteUser.getUsername());
     return true;
   } else if (item.getItemId() == R.id.add_to_blacklist) {
     User user = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
     moveToBlacklist(user.getUsername());
     return true;
   }
   return super.onContextItemSelected(item);
 }
Пример #3
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   if (((AdapterContextMenuInfo) menuInfo).position > 3) {
     toBeProcessUser = adapter.getItem(((AdapterContextMenuInfo) menuInfo).position);
     toBeProcessUsername = toBeProcessUser.getUsername();
     getActivity().getMenuInflater().inflate(R.menu.context_contact_list, menu);
   }
 }