I used listview in fragment but I used list onItemClick
listener not working. My code below and how to perfect solution.
public class StoreProf
Here you go: Use onActivityCreated() instead and use the code here:
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
ListView lv1 = (ListView)getActivity().findViewById(R.id.myStore_listview);
adtstore = new MyListAdapter(getActivity().getApplicationContext());
lv.setAdapter(adtstore);
lv1.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView> arg0, View arg1, int position,
long arg3) {
Toast.makeText(getActivity(), "Item clicked : " + position, Toast.LENGTH_SHORT).show();
}
});
}
Should work now.. :)