SQLite データベースから ArrayList を取得してテキストビューに表示するのに問題があります。アイデアは、ユーザーが過去のエントリを確認できるように、「履歴」ページにすることです。するとtv.setText(db.getAllBalance)
、クラッシュだけが発生し、logcat にはプロジェクトのパッケージ名の後に @4f58a392 のようなものが何度も表示されます。これは、アプリを完成させるための最後のステップであり、苦労しています。任意の支援をいただければ幸いです。
私のデータベース:
//Getting All Balance
public List<Balance> getAllBalance(){
List<Balance> balanceList = new ArrayList<Balance>();
// Select All Query
String selectQuery = "SELECT * FROM " + TABLE_BALANCE;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
Balance balance = new Balance();
balance.setID(Integer.parseInt(cursor.getString(0)));
balance.setAmount(cursor.getFloat(1));
// Adding balance to list
balanceList.add(balance);
} while (cursor.moveToNext());
}
// return contact list
return balanceList;
}
私の歴史の授業:
public class History extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.history);
final DatabaseHandler db = new DatabaseHandler(this);
TextView tv = (TextView) findViewById(R.id.tvSQLinfo);
Log.d("testing", "reading wallet " + db.getAllBalance());
tv.setText((CharSequence) db.getAllBalance());
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
AdView adview = (AdView) findViewById(R.id.adView);
AdRequest re = new AdRequest();
//re.setTesting(true);
adview.loadAd(re);
}
}
「悪い質問」を投稿した悪い歴史があります。しかし、私は約束します、私は検索して検索しましたが、解決策を見つけることができませんでした.