我有一个安卓应用程序。在我的活动之一中,该活动派生自ListActivity
,我已经实现了OnItemLongClickListener
。我想在相关列表项中启用一个删除按钮,其中ListItem
已被长按。我应该如何做?
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);