title: Android list view item click in adapter
body: <p>I have a Fragment class and corresponding adapter class. My Fragment class looks like this - </p>
  
  <pre><code>@Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          myAdapter = new MyAdapter(getActivity(), favourites);
          msgListView.setAdapter(myAdapter );
          return view;
      }
  </code></pre>
  
  <p>In MyAdapter,</p>
  
  <pre><code>    @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          ViewHolder1 viewHolder;
          MyClass favouriteMessage =  favouriteMessageList.get(position);
  
          if (convertView == null) {
              convertView = inflater.inflate(R.layout.favorites_fragment_list, null);
              viewHolder = new ViewHolder1();
              viewHolder.favouriteMessagesList = (TextView)convertView.findViewById(R.id.favourites_list);
              convertView.setTag(viewHolder);
          }else{
              viewHolder = (ViewHolder1) convertView.getTag();
          }
          //Update Your Views Here
          viewHolder.favouriteMessagesList.setText(favouriteMessage.getText());
  
          return convertView;
      }
  
      public void setFavouritesData(ArrayList&lt;FavouriteMessageWrapper&gt; data) {
          favouriteMessageList = data;
          notifyDataSetChanged();
      }
  </code></pre>
  
  <p>I want to implement list view item on click listener. Where do I implement it? If i try to do it in onCreateView of my fragment, it is null.</p>