0
我正在開發一個android應用程序與ListView使用自定義CursorAdapter從SQLite數據庫檢索數據。適配器的(精簡)代碼在下面提供,問題是在onClick()
方法中,pillButton01.setText(Integer.toString(test));
行實際上並未更新UI中的按鈕文本,有什麼建議嗎?在此先感謝自定義CursorAdapter setText()不更新android
public class PillTrackerAdapter extends CursorAdapter implements OnClickListener {
@Override
public void bindView(View view, Context context, Cursor cursor)
{
pillButton01 = (Button) view.findViewById(R.id.pillButton1);
pillButton01.setTag(0);
pillButton01.setOnClickListener(this);
}
@Override
public void onClick(View v)
{
int tag = (Integer) v.getTag();
switch(tag) {
case 0: pillButton01.setText(Integer.toString(test));
test++;
break;
}
}
}