【发布时间】:2011-05-23 01:40:52
【问题描述】:
我在 setViewValue 的代码中更新了我的 TextSwitcher 的文本。但是如果数据库值没有改变,我想避免它的更新。 这是我当前的代码:
public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
int viewId = view.getId();
switch(viewId) {
case R.id.timetext:
TextSwitcher twTime = (TextSwitcher) view;
// something is wrong in the next line
if (!cursor.getString(columnIndex).equals(getText(viewId)))
{
twTime.setText(cursor.getString(columnIndex));
}
return true;
不知何故,数据仍在更新。为什么?
看起来getText() 不能与TextSwitcher 一起正常工作。如何获得它的价值?
【问题讨论】: