我有一个安卓应用程序。在我的一项活动中ListActivity
,我已经实现了OnItemLongClickListener
. 我想在ListItem
已被 LongClicked 的相关列表项中启用删除按钮。我怎样才能做到这一点?
OnItemLongClickListener listener = new OnItemLongClickListener(){
public boolean onItemLongClick(AdapterView<?> av, View v, int position, long id) {
Account a = null;
a = (Account) av.getItemAtPosition(position);
Toast.makeText(AccountActivity.this, "Long Clicked : " + a.getAccountName(), Toast.LENGTH_LONG).show();
//instead of the toast, I need to show/enable a button here...
}
};
getListView().setOnItemLongClickListener(listener);