2

这是我获取查询的功能:

public Cursor getSaldo(String id) {
        String[] args={id};
        return(getReadableDatabase()
        .rawQuery("SELECT sum("+t_jumlah+") "+
                "as "+t_saldo+" "+
                "FROM "+t_table+" WHERE "+t_nId+"=?", args));

我该怎么做才能将数据放入我的TextView?

我有这样的光标

almagId=getIntent().getStringExtra(Nasabah.ID_EXTRA);

Cursor c=helper.getSaldo(almagId);
startManagingCursor(c);
4

1 回答 1

0

你可以做这样的事情。试一试

 if(!cursor.moveToFirst()){
 mytextView.setText("No output");
}
else{
do {
mytextView.setText(cursor.getString(0)); 

} while (cursor.moveToNext());
于 2012-10-17T04:36:15.373 回答