@Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub userMenuAdapter.setChoiceIdx(arg2); Message msg = new Message(); msg.what = MessageID.MESSAGE_POPTITLEMENU; msg.arg1 = arg2; handler.sendMessage(msg); cancel(); }
public PopUserTitleMenu(Context context, int theme, Handler handler, int index) { super(context, theme); // TODO Auto-generated constructor stub this.handler = handler; l = (LinearLayout) ((Activity) context).getLayoutInflater().inflate(R.layout.popusertitlemenu, null); ListView listView = (ListView) l.findViewById(R.id.poptitlemenu_list); // SimpleAdapter adapter = new SimpleAdapter(context, getData(), // R.layout.popusertitlemenu_item, new String[]{"item"}, new int[]{R.id.popusertitlemenu_item}); // listView.setAdapter(adapter); // listView.setOnItemClickListener(listener); setContentView(l, new LayoutParams(CommonUtil.screen_width / 2, LayoutParams.WRAP_CONTENT)); userMenuAdapter = new UserMenuAdapter(context); userMenuAdapter.setChoiceIdx(index); userMenuAdapter.setListStr(RES); listView.setAdapter(userMenuAdapter); listView.setOnItemClickListener(listener); this.setCanceledOnTouchOutside(true); }