如何递增以便我可以获得下一列值而不是列表视图中的新行?

How to increment so can I get the next column value not the new row in list view?

如何获取下一列值而不是新行?

我正在使用列表视图显示微调器中所选用户的信息。

显示的内容:名字,名字,名字

应该改为:名字、姓氏、电子邮件等

我正在考虑添加 i++ 但似乎不起作用

  public void myMethod(String user) {

    ArrayList<String> theList = new ArrayList<>();

    Cursor data = db.getListViewAccountrequestinfo();
    if (data.getCount() == 0) {

    } else {

        while (data.moveToNext()) {


            theList.add( data.getString(0) );
            ListAdapter listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, theList);
            lvinfo.setAdapter(listAdapter);
        }
    }
}

Listview should display the rows in database, not columns.

因为data.getString()取参数为int columnIndex

所以当你增加它的值(columnIndex)时,它会给 Next Column 值而不是新行。

参考Cursor.getString()

我已经知道了。这是我 4 小时后的新工作代码 LOL

 public void myMethod() {

    ArrayList<String> theList = new ArrayList<>();


    Cursor data = db.getListViewAccountrequestinfo(spnpending.getSelectedItem().toString());
    if (data.getCount() == 0) {

    } else {


        if (data.moveToFirst()) {
            do {
                theList.add("Username: " + spnpending.getSelectedItem());
                theList.add("First name: " + data.getString(1));
                theList.add("Last name: " + data.getString(2));
                theList.add("Contact: " + data.getString(3));
                theList.add("Email: " + data.getString(4));

                ListAdapter listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, theList);
                lvinfo.setAdapter(listAdapter);

            } while (data.moveToNext());
        }
    }