EDIT: SOLVED. If there\'s anything focusable in the XML of the items, it will break the touch of the list, in other words, android:focusable=false to all the checkbo
If you want to pass data from fragment to any activity on Listview click then you can modify your code like...
class HistoryFragment extends Fragment { ListView historyListView;
public HistoryFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v= inflater.inflate(R.layout.fragment_history, container, false);
historyListView= (ListView) v.findViewById(R.id.historyDataListView);
sendRequest(); //it is my meathod to load the listview and set the adapter
return v;
}
public void onStart() {
super.onStart();
historyListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
Intent intent=new Intent(getActivity(), DisplayDetails.class);
intent.putExtra("text", historyListView.getItemAtPosition((int) l).toString());
startActivity(intent);
// Toast.makeText(getActivity(),"Hello.. "+historyListView.getItemAtPosition((int) l).toString(),Toast.LENGTH_LONG).show();
}
});
}}