protected void onResume(){
listTimer = (ListView) findViewById(R.id.listTimer);
fetchData();
tadapt = new TimerAdapter(RoutineList, this);
listTimer.setAdapter(tadapt);
listTimer.performItemClick(v1, 0, listval);
super.onResume();
}
listTimer.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
v1 = arg0;
pos = arg2;
listval = arg3;
View v = arg0.getChildAt(arg2);
TextView tvM = (TextView) v.findViewById(R.id.tvETimer);
}
注意:视图上有nullpointerexception。
最佳答案
视图已经在变量arg1中。不需要再给另一个变量赋值。
试试这个…
listTimer.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
v1 = arg0;
pos = arg2;
listval = arg3;
TextView tvM = (TextView) arg1.findViewById(R.id.tvETimer);
}