I really need help with this question because this is the only thing that does not work in my application. I have a list managed by an adapter extending the BaseAdapter.
The getview im function uses convertView to configure OnClickListener. This OnClickListener works well when I touch the screen, but if I use the HTC Desire trackball, I see that the line is blinking on the screen, but OnClickListener is not called ...
I read the Android developer guide: http://developer.android.com/guide/topics/ui/ui-events.html
and tell him that I have to get the onClick event from the trackball ...
I put my getview code here if someone sees anything strange. If you have an idea on what I can do, let me know.
public View getView(int position, View convertView, ViewGroup parent) {
MyTag holder;
if (convertView == null){
convertView = inflater.inflate(R.layout.twolines, null);
holder = new MyTag();
holder.txtData = (TextView)convertView.findViewById(R.id.productTitle);
holder.txtExtra = (TextView)convertView.findViewById(android.R.id.text2);
holder.imgScreenshot = (ImageView)convertView.findViewById(R.id.Screenshot);
holder.imgFlag = (ImageView)convertView.findViewById(R.id.Flag);
holder.mPostButton = (ImageView) convertView.findViewById(R.id.postButton);
convertView.setTag(holder);
} else {
holder = (MyTag)convertView.getTag();
}
holder.mPostButton.setOnClickListener((OnClickListener) new OnPostClickListener(convertView.getContext(),mFacebook, Long.toString(data[position].videoId), data[position].title, data[position].publisher, data[position].imageUrl));
holder.mPostButton.setImageResource(com.cedemo.scan.utils.getPostButtonResId());
if(data[position].title != null)
holder.txtData.setText(data[position].title);
if(data[position].publisher != null)
holder.txtExtra.setText(data[position].publisher);
if(data[position].language != null)
holder.imgFlag.setImageResource(com.cedemo.scan.utils.getFlag(data[position].language));
if(data[position].myVideoScreenshotBm != null)
holder.imgScreenshot.setImageBitmap(data[position].myVideoScreenshotBm);
if(data[position].url != null) {
convertView.setOnClickListener((OnClickListener) new OnProductClickListener(position));
}
return convertView;
}