Android listview position and click event handle problem
I have shown a dynamic listview in my Screen. In listview there are two buttons in eack row. I want to handle click event on both button. I have 50-60 rows in my listview. now when i clicked on any of the row's button it will t开发者_JAVA技巧ake the position of very first row of listview. so my problem is that i have to get perfect position of clicked row. i used baseadapter but i can only able to handle one click event on each row.
so give some hint about this problem.
public class MovietListAdapter extends BaseAdapter {
public int getCount() { return _languagechange; }
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(final int position, View convertView, ViewGroup parent) { View v; LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.movielistdesign, null); ImageView iv = (ImageView) v.findViewById(R.id.icon);
iv.setImageDrawable(mLoader.getDrawble(position));
iv.setPadding(1, 1, 1, 1);
ImageView star = (ImageView) v.findViewById(R.id.starrating);
star.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putString("param1", mLoader.ds1.movie_ids[position]);
bundle.putString("param2",
mLoader.ds1.movie_titles[position]);
bundle.putString("param3",
mLoader.ds1.movie_thumbnailarray[position]);
bundle.putString("param4",
mLoader.ds1.movie_descarray[position]);
bundle.putString("param5",
mLoader.ds1.movie_rating[position]);
精彩评论