SimpleCursorAdapter가있는 앱이 있습니다. DB 테이블의 내용을 목록에 표시 할 수 있지만 목록의 항목을 클릭 할 때 뭔가를하고 싶습니다. 내가 이클립스에서 소스로 가서 clickListener를 오버라이드하려고하면 오버 라이드 할 것이 없다. onListItemClick처럼 재정의 할 메소드를 찾고 있습니다. 어떻게해야합니까?onListItemClick을 재정의하는 방법
이클립스는 또한 onListItemClick 메소드에 대해 불평하지만, 슈퍼 타입 메소드를 재정의하거나 구현해야한다고 말합니다. @Override 주석을 삭제하면 오류가 발생하고 목록이 표시되지만 목록의 항목을 터치해도 이벤트가 실행되지 않습니다.
private class MyAdapter extends SimpleCursorAdapter {
public MyAdapter(Context context, int layout, Cursor c, String[] from,
int[] to) {
super(context, layout, c, from, to);
}
@Override
public
View getView(int position, View convertView, ViewGroup parent) {
Log.e(TAG, "inside myadapter getview");
View v = super.getView(position, convertView, parent);
if(v == null)
return null;
Cursor c = (Cursor)getItem(position);
String phoneName = c.getString(c.getColumnIndex(LoginValidate.C_PHONE_NAME));
String phoneNumber = c.getString(c.getColumnIndex(LoginValidate.C_PHONE_NUMBER));
((TextView)v.findViewById(R.id.phonename)).setText(phoneName);
((TextView)v.findViewById(R.id.phonenumber)).setText(phoneNumber);
((TextView)v.findViewById(R.id.phonename)).setTextColor(Color.BLACK);
((TextView)v.findViewById(R.id.phonenumber)).setTextColor(Color.BLACK);
return v;
}
}// end of adapter
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Log.e(TAG, "clicked an item in list");
}
안녕하세요. – turtleboy