Error: Make sure the Cursor is initialized correctly before accessing data from it?

后端 未结 1 1097
独厮守ぢ
独厮守ぢ 2020-12-19 05:36

I have cursor initialized as follows:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
                


        
1条回答
  •  生来不讨喜
    2020-12-19 06:10

    The column index of a cursor is zero-based, so change:

     cursorState = c.getString(1);
     cursorCapital = c.getString(2);
    

    to

    cursorState = c.getString(0);
    cursorCapital = c.getString(1);
    

    0 讨论(0)
提交回复
热议问题