如何在Android Java中实现呢?
所以我的意思是我该如何读出标记和权重,将它们相乘并用同一系统添加下一行?



这就是我现在要在ListView中列出这些标记的内容:

private void fillData() {

Bundle extras = getIntent().getExtras();
    String txt_sub_id = extras.getString("IDFach");
    int test = Integer.parseInt(txt_sub_id);

Cursor mCursor = db.rawQuery("SELECT _id, subid, name, mark, gewicht, datum FROM tbl_marks WHERE subid = '"+test+"';", null);
startManagingCursor(mCursor);
if (mCursor != null && mCursor.moveToFirst()) {
     int intName = mCursor.getColumnIndexOrThrow("subid");

      do {
          teststring = mCursor.getString(intName);

          String[] from = new String[] { dbHelper.KEY_NAME_MARKS, dbHelper.KEY_MARK_MARKS, dbHelper.KEY_GEWICHT_MARKS, dbHelper.KEY_DATUM_MARKS};
          int[] to = new int[] {R.id.txt_marks_row, R.id.txt_note, R.id.txt_gewicht, R.id.txt_datum};

          SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.show_marks, mCursor, from, to);
          setListAdapter(notes);
      } while (mCursor.moveToNext());
}
    }


看起来像这样:



我喜欢拥有的东西:



提前致谢!

最佳答案

您需要在do / while循环内执行以下操作。这里的4是查询中列名的索引。

  int mark=mCursor.getInt(4);
   int wght=mCursor.getInt(5);

08-03 18:44