Q:

ListView in fragment nothing happen when clicked

What wrong with my code? It's my listView on fragment, to display the database. It's succeed to view database, but nothing happens when I click.
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    db = new MyDatabase(getActivity());
    //View view = inflater.inflate(R.layout.fragment_event, container, false);

    View rootView = inflater.inflate(R.layout.fragment_event, container, false);

    //ArrayList<ListviewContactItem> listContact = GetlistContact();
    final ArrayList<event_constructor> arayList = new ArrayList<event_constructor>();
    //ListView lv = (ListView)getActivity().findViewById(R.id.lv_contact);
    eventListView = (ListView) rootView.findViewById(android.R.id.list);
    //lv.setAdapter(new ListviewContactAdapter(getActivity(), listContact));
    Log.d("EventNul", "Start");
    HashMap<String, String> map = new HashMap<String, String>();
    List<event_constructor> allEvents = db.getAllEvent();
    for (event_constructor event : allEvents) {
        arayList.add(new event_constructor(event.getId(), event.getEventName()));

    }
    // Don't forget to close database connection
    db.closeDB();

    ListAdapter eventAdapter = new ArrayListAdapter(getActivity(), arayList);
    eventListView.setAdapter(eventAdapter);
    eventListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                                int position, long id) {
            // getting values from selected ListItem
            String gid = ((TextView) view.findViewById(R.id.noId)).getText()
                    .toString();
            String gname = ((TextView) view.findViewById(R.id.event)).getText()
                    .toString();
            Log.d("EventId", gid +". "+ gname);

            //Log.d("Item", ItemListId.toString());
            Intent intent = new Intent(getActivity(), NewPostActivity.class);
            intent.putExtra("idEvent", gid);
            startActivity(intent);
        }
    });
    return rootView;

}

A:

Thanks for your attention Waheed, but i not find solution with that. Now my solution is moving "setOnItemClickListener" to "onStart()". And it's work 
    @Override
public void onStart() {
    super.onStart();
    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> av, View v, int pos,
                                long id) {
            String gname = ((TextView) v.findViewById(R.id.event)).getText()
                    .toString();

            String gid = ((TextView) v.findViewById(R.id.noId)).getText()
                    .toString();
            Log.d("EventId", gid +". "+ gname);

            Integer i = Integer.parseInt(gid);
            Intent intent = new Intent(getActivity(), NewPostActivity.class);
            intent.putExtra("idEvent",i);
            startActivity(intent);

        }
    });
}

