title: Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 9 columns
body: <p>I'm trying to load data from my table in sqlite Database to my ExpandableListView inside my activity. I followed the answer from this question <a href="https://stackoverflow.com/questions/10644914/android-expandablelistview-and-sqlite-database">Android ExpandableListView and SQLite Database</a>.</p>
  <p>My parent list will show MVP_INDUSTRY_TYPE Column depends on date Selected,
  My child list will show MVP_BRCH_CODE_NAME and MVP_BRCH_ADDRESS.</p>
  <p>DatabaseHelper. java</p>
  <pre><code>package com.example.spmapp;
  
  import android.annotation.SuppressLint;
  import android.content.ContentValues;
  import android.content.Context;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.database.sqlite.SQLiteOpenHelper;
  
  import androidx.annotation.Nullable;
  
  import java.sql.Connection;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.util.ArrayList;
  import java.util.List;
  
  
  public class DataBaseHelper extends SQLiteOpenHelper {
  
      public static final String MVP_TBL = &quot;MVP_tbl&quot;;
      public static final String MVP_BRCH_CODE_NAME = &quot;MVP_BRCH_CODE_NAME&quot;;
      public static final String MVP_ID = &quot;MVP_ID&quot;;
      public static final String MVP_BRCH_ADDRESS = &quot;MVP_BRCH_ADDRESS&quot;;
      public static final String MVP_AREA = &quot;AREA&quot;;
      public static final String MVP_AREA_CODE = &quot;AREA_CODE&quot;;
      public static final String MVP_INDUSTRY_TYPE = &quot;MVP_INDUSTRY_TYPE&quot;;
      public static final String token = &quot;TOKEN&quot;;
      public static final String MVP_DATE = &quot;SCHEDULED_DATE&quot;;
      public static final String MVP_CLASS_ID = &quot;MVP_CLASS_ID&quot;;
  
  
  
      public DataBaseHelper(@Nullable Context context) {
          super(context, &quot;taggedList.db&quot;, null, 1);
  
      }
  
      @Override
      public void onCreate(SQLiteDatabase sqLiteDatabase) {
          String createMVPVirtualTableStatement = &quot;CREATE VIRTUAL TABLE IF NOT EXISTS &quot; + MVP_TBL + &quot; USING FTS3(&quot; + MVP_BRCH_CODE_NAME + &quot;, &quot; + MVP_ID + &quot; , &quot; + MVP_BRCH_ADDRESS + &quot;, &quot; + MVP_AREA + &quot;, &quot; + MVP_AREA_CODE + &quot;, &quot; + MVP_INDUSTRY_TYPE + &quot;, &quot; + token + &quot;, &quot; + MVP_DATE + &quot;, &quot; + MVP_CLASS_ID + &quot;)&quot;;
          sqLiteDatabase.execSQL(createMVPVirtualTableStatement);
  
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
          onCreate(sqLiteDatabase);
      }
      public Cursor getSelectedParentMVPDate(String txtMVPDate){
          SQLiteDatabase db = this.getWritableDatabase();
          String query = &quot;Select * from &quot;+MVP_TBL+&quot; WHERE &quot; +MVP_DATE+ &quot; LIKE '%&quot;+txtMVPDate+&quot;%' LIMIT 50&quot;;
          return db.rawQuery(query, null);
      }
      public Cursor getSelectedChildMVPDate(String MVPIndustry){
          SQLiteDatabase db = this.getWritableDatabase();
          String query = &quot;Select * from &quot;+MVP_TBL+&quot; WHERE &quot; +MVP_INDUSTRY_TYPE+ &quot; LIKE '%&quot;+MVPIndustry+&quot;%' LIMIT 50&quot;;
          return db.rawQuery(query, null);
      }
  
  }
  </code></pre>
  <p>MasterVisitPlan.java</p>
  <pre><code>public class MasterVisitPlan extends AppCompatActivity implements AdapterView.OnItemSelectedListener,CalendarAdapter.OnItemListener {
  
      private boolean isBackPressedOnce = false;
  
      public static String email;
      public static String VisitDate;
      public static String ItemBrnchCodeName;
      public static String mrCode;
      public static String ClassID;
      private static String token;
      private static String bearerToken;
      public static int counterVisit;
      private RecyclerView calendarRecyclerView;
      private LocalDate selectedDate;
      private TextView monthYearText;
  
  
      TextView empName, empPos, date;
  
      GoogleSignInClient mGoogleSignInClient;
  
      DrawerLayout drawerLayout;
  
      ImageView gps, empPhoto;
  
      ConstraintLayout calendar;
  
      DataBaseHelper dataBaseHelper;
      private Cursor mGroupsCursor; // cursor for list of groups (list top nodes)
      private int mGroupIdColumnIndex;
      private MyExpandableListAdapter mAdapter;
  
      SimpleCursorAdapter sca;
      Cursor csr;
      SearchView searchView;
      ListView Searchlstview;
  
  
      @Override
      protected void onCreate(Bundle savedIntanceState) {
          super.onCreate(savedIntanceState);
          setContentView(R.layout.activity_master_visit_plan);
          initWidgets();
          selectedDate = LocalDate.now();
          setMonthView();
          setOrRefreshListView();
          getCurrentDate();
  
          dataBaseHelper = new DataBaseHelper(MasterVisitPlan.this);
          fillMVPdata();  
      }
  
      private void fillMVPdata(){
          mGroupsCursor = dataBaseHelper.getSelectedParentMVPDate(date.getText().toString());
          startManagingCursor(mGroupsCursor);
          mGroupsCursor.moveToFirst();
  
  
          ExpandableListView Selectedlstview = (ExpandableListView) findViewById(R.id.MVPListitem);
          mAdapter = new MyExpandableListAdapter(mGroupsCursor, this,
  
                  R.layout.mvp_list_parent,
                  R.layout.mvp_list_child,
                  new String[] {DataBaseHelper.MVP_INDUSTRY_TYPE},
                  new int[] {R.id.txtMVPParent},
                  new String[] {DataBaseHelper.MVP_BRCH_CODE_NAME, DataBaseHelper.MVP_BRCH_ADDRESS},
                  new int[] {R.id.txtviewBrnchCodeName, R.id.txtviewBrchAddr});
  
                  Selectedlstview.setAdapter(mAdapter);
  
      }
      public class MyExpandableListAdapter extends SimpleCursorTreeAdapter {
          public MyExpandableListAdapter(Cursor cursor, Context context,int groupLayout, int childLayout, String[] groupFrom,
                                         int[] groupTo, String[] childrenFrom, int[] childrenTo) {
              super(context, cursor, groupLayout, groupFrom, groupTo,
                      childLayout, childrenFrom, childrenTo);
          }
  
          @Override
          protected Cursor getChildrenCursor(Cursor cursor) {
              @SuppressLint(&quot;Range&quot;) Cursor childCursor = dataBaseHelper.getSelectedChildMVPDate(cursor.getString(cursor.getColumnIndex(&quot;MVP_INDUSTRY_TYPE&quot;)));
              startManagingCursor(childCursor);
              childCursor.moveToFirst();
              return childCursor;
          }
      }
  }
  </code></pre>