title: CheckBox in ListView, setVisibility using SimpleCursorAdapter and CursorLoader
body: <p>Please, help me to find a solution how to set my checkboxes visible when I click on menu item "delete" and set invisible when I press "confirm" or "cancel". 
  I use SimpleCursorAdapter, cuz listview is filled from database with cursor loader...
  here is my code:</p>
  
  <p><strong>MainActivity</strong></p>
  
  <pre><code>public class MainActivity extends ActionBarActivity implements LoaderManager.LoaderCallbacks&lt;Cursor&gt;{
  
      final String LOG = "phonebookLogs";
  
      private static final int LOADER_ID = 1;
  
      Intent intentAddContact;
      ListView lvMain;
      CheckBox cbxList;
      MenuItem addContact, deleteContact, settings, expimp, confirmDelete, cancelDelete;
  
      DB mDB;
      SimpleCursorAdapter scAdapter;  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          //find ListView
          lvMain = (ListView)findViewById(R.id.lvMain);
  
          //calling for creating adapter
          onCreateAdapter();
  
      }
  
      public void onCreateAdapter(){
  
          String[] from = new String[] { DB.COL_LINK, DB.COL_SURNAME, DB.COL_NAME };
          int[] to = new int[] { R.id.ivPhoto, R.id.tvSurname, R.id.tvName, };
          if(to[0] == 0){
              to[0] = R.drawable.default_contact;
          }
  
          scAdapter = new SimpleCursorAdapter(this, R.layout.item, null, from, to, 0);
          lvMain.setAdapter(scAdapter);
  
          // loader for reading data
          getSupportLoaderManager().initLoader(LOADER_ID, null, this);
      }   
  
      public void deleteRecord(){
          //when MenuItem "Delete" is clicked
          addContact.setVisible(false);
          deleteContact.setVisible(false);
          settings.setVisible(false);
          expimp.setVisible(false);
          confirmDelete.setVisible(true);
          cancelDelete.setVisible(true);
  
      }
  
      public void onCancelDeleteRecord(){
          ////when MenuItem "cancel" is clicked
          addContact.setVisible(true);
          deleteContact.setVisible(true);
          settings.setVisible(true);
          expimp.setVisible(true);
          confirmDelete.setVisible(false);
          cancelDelete.setVisible(false);
  
      }
  
      public void confirmDeleteRecord(){
          ////when MenuItem "confirm" is clicked
          addContact.setVisible(true);
          deleteContact.setVisible(true);
          settings.setVisible(true);
          expimp.setVisible(true);
          confirmDelete.setVisible(false);
          cancelDelete.setVisible(false);
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.main, menu);
          return super.onCreateOptionsMenu(menu);
      }
  
      @Override
      public boolean onPrepareOptionsMenu(Menu menu)
      {
          //find all MenuItems
          addContact = menu.findItem(R.id.addContact);
          deleteContact = menu.findItem(R.id.deleteContact);
          settings = menu.findItem(R.id.settings);
          expimp = menu.findItem(R.id.expimp);
          confirmDelete = menu.findItem(R.id.confirmDelete);
          cancelDelete = menu.findItem(R.id.cancelDelete);    
  
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item){
          switch(item.getItemId()){
          case R.id.addContact:
              intentAddContact = new Intent(this, NewContact.class);
              startActivity(intentAddContact);
              break;
          case R.id.deleteContact:
              deleteRecord();
              break;
          case R.id.settings:
  
              break;
          case R.id.expimp:
  
              break;
          case R.id.confirmDelete:
              confirmDeleteRecord();
              break;
          case R.id.cancelDelete:
              onCancelDeleteRecord();
              break;
          default:
              break;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle bndl) {
          return new MyCursorLoader(this, mDB);
      }
  
      @Override
      public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor cursor) {
          scAdapter.swapCursor(cursor);
      }
  
      @Override
      public void onLoaderReset(Loader&lt;Cursor&gt; loader) {
          scAdapter.swapCursor(null);
      }
  
  }
  </code></pre>
  
  <p>DB.class and CursorLoader.class are fine, simple query and loading.
  and my XML-file for ListView</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="@dimen/margin"
      android:orientation="horizontal" &gt;
  
      &lt;LinearLayout
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_margin="@dimen/margin"
          android:layout_weight="0.5"
          android:orientation="horizontal" &gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="@dimen/margin"
              android:orientation="vertical" &gt;
  
              &lt;ImageView
                  android:id="@+id/ivPhoto"
                  android:layout_width="@dimen/imageWidth"
                  android:layout_height="@dimen/imageHeight"
                  android:layout_gravity="center_vertical"
                  android:contentDescription="@string/photoDescription"
                  android:src="@drawable/default_contact" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;TextView
              android:id="@+id/tvName"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center_vertical"
              android:layout_marginLeft="@dimen/margin"
              android:text=""
              android:textSize="@dimen/textSize" /&gt;
  
          &lt;TextView
              android:id="@+id/tvSurname"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center_vertical"
              android:layout_marginLeft="@dimen/margin"
              android:text=""
              android:textSize="@dimen/textSize" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;CheckBox
          android:id="@+id/cbxList"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:layout_marginLeft="@dimen/margin"
          android:layout_weight="0.2"
          android:visibility="invisible" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I have read a lot already, but how to realize it without creating my own adapter still can't get...
  will be thanksfull to any help in finding solution!</p>