【发布时间】:2014-05-07 09:41:04
【问题描述】:
我正在制作一个应用程序,它可以在屏幕上进行触摸。我可以将数据保存在 textview 上,但我想将数据保存到 listview 中,以便随着数据的保存而不断增加。我还想在同一列表视图的点击次数旁边显示当前日期。 例如:
2014 年 5 月 6 日:你触摸了 6 次
2014 年 5 月 7 日:你触摸了 9 次
对于屏幕触摸,我使用以下代码:-
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_UP)
try {
if (nearCount >=0 ) {
tv.setText("" + nearCount++);
}
} catch (Exception e) {
e.printStackTrace();
}
return super.onTouchEvent(event);
}
应用关闭时是否必须使用共享偏好来存储数据??
【问题讨论】:
标签: android listview calendar sharedpreferences