title: onClick to edit CheckBox data on ListView
body: <p>I saved some text by using <code>FileOutputStream</code> to a file and then displayed them on a <code>ListView</code>.</p>
  
  <p>I'm trying to edit the content by <strong>first</strong> check the checkbox of the item, then click a button to either Edit or Delete the data.</p>
  
  <p>I did a lot of research but still couldn't understand how to implement this</p>
  
  <p>Here are my codes</p>
  
  <p>To show the data and display them on <code>ListView</code></p>
  
  <pre><code>void ShowSavedFiles() {
      //SavedFiles = getApplicationContext().fileList();
      SavedFiles = getApplication().fileList();
      ArrayAdapter&lt;String&gt; adapter
              = new ArrayAdapter&lt;String&gt;(this,
              android.R.layout.simple_list_item_1,
              SavedFiles);
  
      listView.setAdapter(adapter);
      if (adapter.isEmpty()) {
          Toast.makeText(getBaseContext(), "There is no Address !", Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p>To edit the data by checking <code>CheckBox</code>, then press Edit button</p>
  
  <pre><code>void editData(){
      imgEditData.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              if (choiceMode == false) {
  
                  choiceMode = true;
                  clickAble = false;
                  multiSelectBar.setVisibility(View.VISIBLE);
                  Toast.makeText(addressActivity.this, "Edit ON", Toast.LENGTH_SHORT).show();
                  listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                      @Override
                      public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                          // change the checkbox state
                          CheckedTextView checkedTextView = ((CheckedTextView) view);
                          checkedTextView.setChecked(!checkedTextView.isChecked());
                      }
                  });
                  ArrayAdapter&lt;String&gt; adapter
                          = new ArrayAdapter&lt;String&gt;(addressActivity.this,
                          android.R.layout.simple_list_item_multiple_choice,
                          SavedFiles);
                  listView.setAdapter(adapter);
              }}
      });
  }
  </code></pre>
  
  <p>a picture of it to better understand</p>
  
  <p><a href="https://i.stack.imgur.com/rHd4M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rHd4M.png" alt="enter image description here"></a></p>
  
  <p>Ignore the other buttons</p>