How do I disabled (dim) an option in onItemLongClick from a ListView in Android? -


When an item is clicked in my list view, then I have several options popped up in a dialog for user selection Are up. However, there are different scenarios where I would like to disable one or more options so that users can choose them. Here's some code.

  Public class IApp ListActivity tool extends OnItemClickListener, OnItemLongClickListener {Personal Static FINAL END HOW_MANY = 4; Private stable final int ADD = 0; Private static final interval EDIT = 1; Private static final integer OPEN = 2; Personal fixed final difference DELETE = 3; Private string [] myItemClickDialog = null; ... @ Override Public Wide On Create (Bundle Eye) {Super. Cottage SetContentView (R.layout.mylayout); This.myItemClickDialog = New string [HOW_MANY]; This.myItemClickDialog [ADD] = "Add"; This.myItemClickDialog [EDIT] = "edit"; This.myItemClickDialog [OPEN] = "Open"; This.myItemClickDialog [DELETE] = "Delete"; } @ Override Public Finals Boolean on ITEM Longclick (Last Adaptor View & lt ;? & gt; parent, see final view, final integer status, last long ID) {final reference reference = this; Builder Builder = New Builder (reference); Builder.setTitle ("Options"); String [] items = this.myItemClickDialog; Builder .Set Items (Item, New DialogInterface.OnClickListener) {@Override Public Zero Click Click (Last Dialogue Interface Dialogue, Last Favours) {Switch (Joe) {Add Case: // Do stuff break; Case EDIT: // Do stuff break; Open the case: // Does the bag break: Remove the case: // Do not break the stuff;}} // Here the rest of the code  

I would like to be able to disable (via Deming ) Depending on a particular option, such as DELETE option or open option, which item was clicked (I got the share which is the identity piece).

Unfortunately this does not seem likely. The AlertDialog.builder system has not taken it into its customization options. I saw the source code to verify it.

I think you have considered the simple approach of not displaying those options? That is, at that particular moment is only making a copy of the array with valid strings?


Comments