メソッド onClick() は、position == 0 の場合にのみ機能しますか? なんで?
public class mySCAdapter extends SimpleCursorAdapter implements OnClickListener {
final String LOG_TAG = "myLogs";
LayoutInflater inflater;
public mySCAdapter(Context context, int layout, Cursor c, String[] from,
int[] to) {
super(context, layout, c, from, to);
inflater = LayoutInflater.from( context );
// TODO Auto-generated constructor stub
}
@Override
public View getView( int position, View convertView, ViewGroup parent) {
View v = null;
if( convertView != null )
v = convertView;
else
v = inflater.inflate( R.layout.add_program_ex_list_item, parent, false);
ImageButton button = (ImageButton) v
.findViewById(R.id.add_program_exercise_list);
button.setTag(position);
button.setOnClickListener(this);
return super.getView(position, convertView, parent);
}
@Override
public void onClick(View v) {
Log.d(LOG_TAG, "It works, pos=" + v.getTag());
}
}