How To Get Custom Gird Child Item Click Event?
I am struggling with custom Gird view. Not exactly with Custom Gird view but its click event of child view. Major two query : first : issues is if i add simple image view and text
Solution 1:
in you getView for example
viewHolder.checkbox.setOnCheckedChangeListener(listenerCheckBox);
and listener
OnCheckedChangeListener listenerCheckBox = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
}
};
and you item_grid for example
public class Item {
private String title;
private String description;
private Date pubDate;
private String link;
public Item(String title, String description, Date pubDate, String link) {
this.title = title;
this.description = description;
this.pubDate = pubDate;
this.link = link;
}
public String getTitle() {
return this.title;
}
public String setTitle(String title_) {
this.title = title_;
}
}
\\\\\\\\\\\\\\\\\\\\
if you case
if (convertView == null) {
view = new ViewHolder();
convertView = inflator.inflate(R.layout.grid_item, null);
view.imgViewFlag = (ImageView) convertView
.findViewById(R.id.imageView1);
view.txt = (TextView) convertView
.findViewById(R.id.grid_item_label);
view.btn1 = (Button) convertView.findViewById(R.id.button1);
view.btn2 = (Button) convertView.findViewById(R.id.button2);
view.btn1.setOnClicListener(myClickListener);
convertView.setTag(view);
} else
\\\\\\\\\\\\\\\\\\\\\\\\
private OnClickListener myClickListener = new OnClickListener() {
public void onClick(View v) {
}
};
\\\\\\\\\\\\\\\\\\\\\\\
Post a Comment for "How To Get Custom Gird Child Item Click Event?"