Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old February 9th, 2012, 03:35 AM   #1 (permalink)
New Member
 
Join Date: May 2011
Location: New Delhi
Posts: 13
 
Device(s):
Thanks: 0
Thanked 1 Time in 1 Post
Default problem in Custom Listview click event handling

Hi all,

I am using Custom listview in my application. Each Row of custom List contains checkbox and 2 TextView. I am able to populate data using CustomAdapter class which extends ArrayAdapter<MyContact>.

The problem I am facing is that I am not able to handle click event on List Row i.e. I am not able to listen which row is clicked on the listview for further action. Help me...

here is the code I am using for CustomAdapter class..

class CustomAdapter extends ArrayAdapter<MyContact> {

private final int resource;

public CustomAdapter(Context context, int resource, ArrayList<MyContact> objects) {
super(context, resource, objects);
this.resource = resource;
}

@Override
public int getCount() {
return allContactsList.size();
}

@Override
public MyContact getItem(int position) {
return allContactsList.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

if(convertView == null) {
convertView = View.inflate(getContext(), resource, null);
}

MyContact buddy = getItem(position);
if(buddy != null) {
TextView buddyName = (TextView) convertView.findViewById(R.id.buddyName);
//TextView buddyEmailId = (TextView) v.findViewById(R.id.buddyEmail);
TextView buddyDob = (TextView) convertView.findViewById(R.id.buddyDob);
CheckBox isSelected = (CheckBox) convertView.findViewById(R.id.isSelected);

buddyName.setText(buddy.getName());
//buddyEmailId.setText(buddy.getEmail());
buddyDob.setText(buddy.getDob());
isSelected.setTag(buddy.getEmail());
}
return convertView;
}

}

manvinder is offline  
Reply With Quote
Sponsors
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 12:16 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo