Get position in ListView
Try
public void DetailClick(View v) {
ListView lv = getListView();
int position = lv.getPositionForView(v);
}
You can try like this.
Step 1: In your custom adapter
@Override
public view getView(int position, View convertView, ViewGroup parent){
.......//Perform your logic
convertView.findViewById(R.id.BtnToClick).setTag(position);
return convertView;
}
Step 2: In onclick listener
public void myClick (View v) {
LinearLayout vwParentRow = (LinearLayout)v.getParent();
position=(Integer) v.getTag();
}