検索したデータをリストに保存する際に問題があります。私の保存配列と配列リストの構造を誰かがチェックしてくれませんか。ありがとう。
Tag CursorWinow: bad request for field slot 0,12. numRows = 49, numColumns =12
public List<HashMap<String, String>> getAllDataFromTable(String tableName) {//, String[] ColumnList
List<HashMap<String, String>> TableDataCollection;
TableDataCollection = new ArrayList<HashMap<String, String>>();
String selectQuery = "SELECT * FROM " +tableName;
SQLiteDatabase database = this.getWritableDatabase();
Cursor cursor = database.rawQuery(selectQuery, null);
String ColumnCollection[];
int totalRecord=cursor.getColumnCount();
if(tableName=="tbl_account_codes")
{
if (cursor.moveToFirst()) {
do {
int i=cursor.getColumnNames().length;
ColumnCollection=new String[i];
String MainColumnCollection[];
MainColumnCollection=new String[i];
String[] MyColumn= ColumnCollection=cursor.getColumnNames();//column
for(int a=0;a<=i;a++)
{
MainColumnCollection[a]=(cursor.getString(a).toString());//= ColumnCollection[a]
String z="wala lang";
String x="wala lang";
//String AssignCol= MyColumn[a];
}
TableDataCollection.add((HashMap<String, String>) Arrays.asList(MainColumnCollection));
String c="wala lang";
} while (cursor.moveToNext());
}
return TableDataCollection;
}
TableDataCollection.add((HashMap<String, String>) Arrays.asList(MainColumnCollection));
この行で問題が発生しています。ありがとう