Reputation: 11
My problem: I have main class and 3 fragments controlled using swipe (SectionsPagerAdapter
extends FragmentPagerAdapter
).
On all of the fragments we use listview to generate list with data from SQLite. This works fine however the onItemclick methods do not work - We have tried several approaches without success.
We use custom simpleCursorAdaptor and set the view via getView method of Adaptor. Again this works just fine. We get nice tablerows with the content from the DB.
Does anybody have an example we can look at to fix our issues? Example without ListFragment.
Some of our code looks like this:
public class TranssaktionFragment extends Fragment implements OnItemClickListener
listview.setAdapter(transsaktionadaptor);
listview.setOnItemClickListener(new OnItemClickListener() {
private String TAG;
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Log.v(TAG, "*****************************Clicked************************* " );
}
});
Upvotes: 1
Views: 2674
Reputation: 485
I had the same issue, onItemClick didn't called. There is a Relativelayout with an Image in the custom ListRow. I've added android:focusable="false"
to the Relativelayout and now it works again. I'm wondering why but it works. Thanks to Luksprog!!
Upvotes: 1