title: ListView doesn't work for fragment
body: <p>i have a small problem with my ListView, It works when i use an Activity but when I switch to a fragment it doesn't work.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>package com.groupex.tp_mobile;
  
  import android.annotation.TargetApi;
  import android.content.Context;
  import android.content.Intent;
  import android.content.SharedPreferences;
  import android.content.res.Resources;
  import android.os.Build;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentActivity;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.View;
  import android.view.ViewGroup;
  import android.webkit.WebView.FindListener;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.ImageView;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import java.util.zip.Inflater;
  
  
  public class Fragment1 extends Fragment implements OnItemClickListener{
  
  ListView listView;
  communicator communic;
  String[] nameMenu;
  String[] menuDescription;
  int[] images={R.drawable.pizza, R.drawable.frenchfries, R.drawable.fishsoup, R.drawable.tomatosoup};
  
  public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View view=inflater.inflate(R.layout.fragment1, container, false);
      listView=(ListView) view.findViewById(R.id.menu1);
      Resources resources=getResources();
      nameMenu=resources.getStringArray(R.array.nameMenu);
      menuDescription=resources.getStringArray(R.array.menuDescription);
      CustomAdapter adapter=new CustomAdapter(container.getContext(), nameMenu, images, menuDescription);
      listView.setAdapter(adapter);
      listView.setOnItemClickListener(this);
  
      return view;
  }
  
  class CustomAdapter extends ArrayAdapter&lt;String&gt;{
      Context context;
      int[] imags;
      String[] nameMenuArray;
      String[] menuDescriptionArray;
  
      CustomAdapter(Context c, String[] titles, int imgs[], String[] descri){
          super(c, R.layout.singlerow, R.id.textViewNom, titles);
          this.context=c;
          this.imags=imgs;
          this.nameMenuArray=titles;
          this.menuDescriptionArray=descri;
      }
  
  
      class MyViewHolder{
              ImageView MyImage;
              TextView MyTitle;
              TextView MyDescription;
              public MyViewHolder(View view) {
                  // TODO Auto-generated constructor stub
                  MyImage=(ImageView)view.findViewById(R.id.images);
                  MyTitle=(TextView)view.findViewById(R.id.textViewNom);
                  MyDescription=(TextView)view.findViewById(R.id.textViewFonction);
  
              }
          }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
          View row=convertView;//On recuere le relative layout
          MyViewHolder holder=null;
          if(row==null){
              LayoutInflater inflater=(LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              row=inflater.inflate(R.layout.singlerow, parent, false);
              holder=new MyViewHolder(row);
              //We store the holder in the row by using setTag(Object)
              row.setTag(holder);
              android.util.Log.d("Dehii", "New row has been created");
          }
          //Recyclage.
          else{
              holder=(MyViewHolder) row.getTag();
              android.util.Log.d("Dehii", "Recycling a row");
          }
          holder.MyImage.setImageResource(imags[position]);
          holder.MyTitle.setText(nameMenuArray[position]);
          holder.MyDescription.setText(menuDescription[position]);
          return row;
      }
  }
  
  
  @Override
  public void onItemClick(AdapterView&lt;?&gt; arg0, View view, int i, long l) {
      // TODO Auto-generated method stub
  }
  
  public void setCommunicator(communicator commun){
      this.communic=commun;
  }
  
  public interface communicator{
      public void respond(int index);
  }
  
  } // End class definition
  </code></pre>
  
  <p>And here is the error messages : </p>
  
  <pre><code>FatalException: NullPointerException
  
  Fragment.customAdapter.$CustomView(Fragment1.java:104)
  .
  .
  .
  .
  .
  android.widget.ListView.OnMeasure(ListView java:1175)
  </code></pre>
  
  <p>I don't have enough reputation yet to add an image.</p>
  
  <p>Thank you for your help.</p>