title: how to create a custom array adapter in android studio to disable clicks on list view item
body: <p>current Uni student and i am trying to create a custom array adapter class that extends the ArrayAdapter class so i can disable clicks on selected items in the list view.</p>
  <p>I am unsure how to implement this new class
  this is what i have so far</p>
  <pre><code>package com.example.assignment1;
  
  import android.content.Context;
  import android.widget.ArrayAdapter;
  
  import androidx.annotation.NonNull;
  
  public class customAdapter extends ArrayAdapter {
      public customAdapter(@NonNull Context context, int resource) {
          super(context, resource);
      }
  
      @Override
      public boolean areAllItemsEnabled() {
          return false;
      }
  
      @Override
      public boolean isEnabled(int position) {
         // return super.isEnabled(position);
      }
  }
  </code></pre>
  <p>I am unsure how to write the isEnabled function as well:</p>
  <p>this is how i intend to use this function</p>
  <pre><code>listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, final int position, long id) {
                  poss = position + 1;
                  AlertDialog.Builder builder = new AlertDialog.Builder(viewFriends.this);
                  builder.setTitle(&quot;Notice&quot;);
                  builder.setMessage(&quot;Please select to to edit, delete a friend or cancel&quot;);
  
                  // add the buttons
                  builder.setPositiveButton(&quot;Edit&quot;, new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
  
                           //System.out.println(poss);
                          Intent intent = new Intent(getApplicationContext(), editOrDelete.class);
                          ArrayList&lt;String&gt; result1 = mydb.retrieveRow(poss);
                          name = result1.get(1);
                          age = result1.get(2);
                          gender = result1.get(3);
                          address = result1.get(4);
                          code = result1.get(0);
                          intent.putExtra(&quot;code&quot;, code);
                          intent.putExtra(&quot;name&quot;, name);
                          intent.putExtra(&quot;age&quot;, age);
                          intent.putExtra(&quot;gender&quot;, gender);
                          intent.putExtra(&quot;address&quot;, address);
                          startActivity(intent);
                      }
                  });
                  builder.setNeutralButton(&quot; Delete&quot;, new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
  
                          System.out.println(poss);
                          mydb.updateDeleted(poss);
                         if(listView.getChildAt(position).isEnabled())
                          {
                             listView.getChildAt(position).setEnabled(false);
                            // function to disable clicks
                         }
                      }
                  });
                  builder.setNegativeButton(&quot;Cancel&quot;, null);
                  AlertDialog dialog = builder.create();
                  dialog.show();
  
  
              }
          });
  
  
  
      }
  public void displayFriendList() {
          ArrayList&lt;String&gt; result = mydb.retrieveRows();
          ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
                  android.R.layout.simple_list_item_1, result);
          listView.setAdapter(adapter);
      }
  </code></pre>
  <p>so when the user clicks the delete button from the alert i would like to grey out the item they clicked on in the list view (i managed to achieve this) but i would also like for it not to be able to be clicked on once it has been deleted</p>
  <p>and suggestions on how i can achieve this?</p>