I am creating custom listview adapter, which made with 2 textview(tvA and tvB), a spinner(with fixed 3 values) and a button(okButton). The list's data are dynamically filling. When buttonOk is pressed both getting both textviews values and also spinner's current selected item and toast it.
How can i do this? sorry for my english.
In your getView() method where you populating your values add this listener.
okButton.setOnClickListener(new OnItemClickListener(position, tvA, tvB, spinner));
and create the the OnItemClickListener class like this
private class OnItemClickListener implements View.OnClickListener {
private int mPosition;
OnItemClickListener(int position, TextView tvA, TextView tvB, Spinner spinner) {
mPosition = position;
...
}
@Override
public void onClick(View arg0) {
// handle everything here
}
}