OnItemClickListener on a ListView inside a Fragment not working
Just put
android:focusable="false"
android:clickable="false"
in layout. For all textviews,buttons etc.
Here's a code snippet that'll do what you want.
ListView lv;
//code to get the listView instance using findViewByID etc
lv.setOnItemClickListener(new OnItemClickListener()
{
@Override public void onItemClick(AdapterView<?> arg0, View arg1,int position, long arg3)
{
Toast.makeText(EnclosingActivity.this, "Stop Clicking me", Toast.LENGTH_SHORT).show();
}
});
People usually trip on this, see if you have got this covered:
All clicks and call backs (eg: the menu/actionbar callbacks) are sent to the activity the fragment is bound to, so they must be in the activity class and not the fragment class.