tóm tắt một số code Android

2 221 0
tóm tắt một số code Android

Đang tải... (xem toàn văn)

Thông tin tài liệu

Đặt onItemLongClickListener cho custom ListView android:descendantFocusability="blocksDescendants" Gửi result trở lại Intent resultIntent = new Intent();// TODO Add extras or a data setResult(Activity.RESULT_OK, resultIntent); finish(); Nhận Result từ activity @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Check which request we're responding to if (requestCode == PICK_CONTACT_REQUEST) { // Make sure the request was successful if (resultCode == RESULT_OK) { // The user picked a contact // The Intent's data Uri identifies which contact was selected // Do something with the contact here (bigger example below) } } } Adapter class PhongBanAdapter extends ArrayAdapter { private Activity context; private int layoutID; private List dsPhongBan; public PhongBanAdapter(Activity context, int resource, List objects) { super(context, resource, objects); this.context=context; this.layoutID=resource; this.dsPhongBan=objects; } @Override public View getView(int position, View convertView, ViewGroup parent) { convertView=context.getLayoutInflater().inflate(layoutID,null); PhongBan pb=dsPhongBan.get(position); ((TextView)convertView.findViewById(R.id.lvi_title)).setText(pb.toString()); ((TextView)convertView.findViewById(R.id.lvi_desc)).setText(pb.getDetail()); return convertView; } } onCreateContextMenu public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo){ super.onCreateContextMenu(menu, v, menuInfo); getMenuInflater().inflate(R.menu.context1, menu); } onContextItemSelected ggggggg

Ngày đăng: 29/12/2015, 23:07

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan