title: listview in Fragment
body: <p>Something wrong the XML,Please correct me and thank you in advance, below is the code?</p>
  
  <p>Sorry i don't speak english 100/100.</p>
  
  <pre><code>public class Les_agences
      extends Fragment {
          /* ****************************************** */
          /*              Les Variables                */
          /* ****************************************** */
  
      public String string_ip = "192.168.42.168";
      public Resources res;
      public JSONObject json;
      public ListView les_agence_tete_lsiteview;
      public TextView les_agence_tv_item_adresse;
      public TextView les_agence_tv_item_nom;
      public ImageView les_agences_iv_item_image;
      public ListView liste_view;
      ArrayList&lt;item_Les_agences_liste_view&gt; liste;
      item_Les_agences_liste_view item;
      JSONArray jsonoarray = null;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
              /* pour creer le fragment*/
          les_agence_tv_item_adresse = (TextView) getActivity().findViewById(R.id.les_agence_tv_item_adresse);
          les_agence_tv_item_nom = (TextView) getActivity().findViewById(R.id.les_agence_tv_item_adresse);
          les_agences_iv_item_image = (ImageView) getActivity().findViewById(R.id.les_agences_iv_item_image);
          View x = inflater.inflate(R.layout.les_agences, container, false);
          return x;
      }
  
      @Override
      public void onStart() {
          super.onStart();
          res = getResources();
      }
  
      @Override
      public void onResume() {
          super.onResume();
          connecter();
      }
  
      void connecter() {
          new AsyncTask&lt;Void, Void, Boolean&gt;() {
              ProgressDialog progress;
  
              @Override
              protected void onPreExecute() {
                  super.onPreExecute();
                  progress = ProgressDialog.show(getActivity(), res.getString(R.string.act2_connexion), res.getString(R.string.act2_attendre), false, false);
              }
  
              @Override
              protected Boolean doInBackground(Void... params) {
                  thread processus = new thread();
                  processus.setPaire(null);
                  processus.seturl("http://" + string_ip + "/agence_de_location/les_agences.php");
                  processus.start();
                  try {
                      processus.join();
                  } catch (InterruptedException e1) {
                      e1.printStackTrace();
                  }
                  json = processus.getJson();
                  if (json == null) {
                      return (false);
                  } else {
                      return (true);
                  }
              }
  
              @Override
              protected void onPostExecute(Boolean result) {
                  progress.dismiss();
                  if (result == false) {
                      Toast.makeText(getActivity(), res.getString(R.string.act2_erreur_connexion), 10000).show();
                  } else {
                      int val = 0;
                      try {
                          val = json.getInt("val");
                      } catch (JSONException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                      if (val == 0) {
                          Toast.makeText(getActivity(), res.getString(R.string.act2_erreur_connexion), 10000).show();
                      } else {
                          /******************************************************** */
                                  /*              Pour afficher les agences                 */
                          /******************************************************** */
                          // pour afficher    
                          liste = new ArrayList&lt;item_Les_agences_liste_view&gt;();
                          try {
                              jsonoarray = (JSONArray) json.get("agence");
                          } catch (JSONException e) {
                          }
                                      /* Yes return les champs  */
                          int indice;
                          item_Les_agences_liste_view item;
                          for (indice = 0; indice &lt;= jsonoarray.length() - 1; indice++) {
  
                                          /* new array , grand array agence 0 : 1 : 2 : ... 
                                           *petit array 0: .... 
                                           */
                              JSONObject petitearray = null;
                              try {
                                  petitearray = jsonoarray.getJSONObject(indice);
                              } catch (JSONException e) {
                                  // TODO Auto-generated catch block
                                  e.printStackTrace();
                              }
                                          /* catch entre new class */
                              try {
                                  Log.i(petitearray.getString("nom_agence"), petitearray.getString("nom_agence"));
                                  item = new item_Les_agences_liste_view(petitearray.getString("nom_agence"), petitearray.getString("adresse_agence"), petitearray.getString("image_agence"));
                                  liste.add(item);
                              } catch (JSONException e) {
                                  // TODO Auto-generated catch block
                                  e.printStackTrace();
                              }
                          }
                      }
                  }
                  liste_view = (ListView) getActivity().findViewById(R.id.Les_agences_lv);
                  Adapter_les_agences_list_view adapter = new Adapter_les_agences_list_view(getActivity().getApplicationContext(), liste);
                  liste_view.setAdapter(adapter);
              }
          }.execute();
      }
      /******************************************************** */
          /*              class adapter                             */
  
      /**
       * *****************************************************
       */
  
      class Adapter_les_agences_list_view
          extends ArrayAdapter&lt;item_Les_agences_liste_view&gt; {
  
          private Context context;
          private ArrayList&lt;item_Les_agences_liste_view&gt; liste;
  
          public Adapter_les_agences_list_view(Context context, ArrayList&lt;item_Les_agences_liste_view&gt; liste) {
              super(context, R.layout.les_agences_liste_view, liste);
              this.context = context;
              this.liste = liste;
          }
  
          // le nombre des élements de la lsite 
          @Override
          public int getCount() {
              return liste.size();  // nmbre des element 
          }
  
          @Override
          public long getItemId(int position) {
              return position;
          }
  
          @Override
          public View getView(final int position, View convertView, ViewGroup parent) {
              View new_place = convertView;
              if (convertView == null)//adapter le 1er fois s 
              {
                  // style
                  LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                  View rowView = li.inflate(R.layout.les_agences_liste_view, null);
              }
              les_agence_tv_item_adresse = (TextView) getActivity().findViewById(R.id.les_agence_tv_item_adresse);
              les_agence_tv_item_nom = (TextView) getActivity().findViewById(R.id.les_agence_tv_item_adresse);
              //les_agences_iv_item_image=(ImageView)convertView.findViewById(R.id.les_agences_iv_item_image);
              return convertView;
          }
      }
  }
  </code></pre>
  
  <p>the file of network is true .</p>
  
  <pre><code>public class Menu
      extends FragmentActivity {
      private ViewPager menu_viewpager;
      private android.support.v4.view.PagerAdapter pageradapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          setContentView(R.layout.menu);
          menu_viewpager = (ViewPager) findViewById(R.id.menu_viewpager);
          pageradapter = new Adapter_menu(getSupportFragmentManager());
          menu_viewpager.setAdapter(pageradapter);
      }
  
      @Override
      protected void onStart() {
          super.onStart();
          le_swap();
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          TextView les_agence_tv_item_adresse = (TextView) findViewById(R.id.les_agence_tv_item_adresse);
          TextView les_agence_tv_item_nom = (TextView) findViewById(R.id.les_agence_tv_item_adresse);
          ImageView les_agences_iv_item_image = (ImageView) findViewById(R.id.les_agences_iv_item_image);
          les_agences_iv_item_image.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  Toast.makeText(Menu.this, "ss", 1000);
              }
          });
      }
  
      void le_swap() {
      }
  }
  </code></pre>
  
  <p>the menu , main of programm</p>
  
  <p>the menu , main of programm</p>
  
  <pre><code>package PFD.agence_d_allocation;
  
  import PFD.agence_d_allocation.R.string;
  import android.R.integer;
  import android.annotation.SuppressLint;
  import android.app.Activity;
  import android.app.Fragment;
  import android.content.res.Resources;
  import android.graphics.Point;
  import android.os.Bundle;
  import android.provider.ContactsContract.CommonDataKinds.Event;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  import android.support.v4.app.FragmentStatePagerAdapter;
  import android.support.v4.internal.view.SupportMenu;
  import android.support.v4.view.PagerAdapter;
  import android.support.v4.view.ViewPager;
  import android.util.DisplayMetrics;
  import android.util.Log;
  import android.util.TypedValue;
  import android.view.Display;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.view.ViewDebug.IntToString;
  import android.view.MotionEvent;
  import android.view.ViewTreeObserver;
  import android.view.Window;
  import android.widget.Button;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import android.widget.ViewFlipper;
  public class Menu extends FragmentActivity  {
      private ViewPager menu_viewpager ; 
      private android.support.v4.view.PagerAdapter pageradapter;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          setContentView(R.layout.menu);
  
          menu_viewpager = (ViewPager) findViewById(R.id.menu_viewpager);
          pageradapter = new Adapter_menu(getSupportFragmentManager());
          menu_viewpager.setAdapter(pageradapter);
  
  
      }
  
  
      @Override
      protected void onStart() {
          super.onStart();
          le_swap();
      }
  
      @Override
      protected void onResume() {
  
          super.onResume();
  
  
  
      }
  
  
  
  
      void le_swap()
      {
  
      }
  
  
  
  
  
  
  
  
  }
  </code></pre>
  
  <p>the log cat </p>
  
  <pre><code>05-09 11:40:06.158: D/dalvikvm(544): GC_FOR_ALLOC freed 3K, 3% free 10326K/10631K, paused 41ms
  05-09 11:40:06.348: D/AndroidRuntime(544): Shutting down VM
  05-09 11:40:06.348: W/dalvikvm(544): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
  05-09 11:40:06.408: I/dalvikvm(544): threadid=3: reacting to signal 3
  05-09 11:40:06.459: E/AndroidRuntime(544): FATAL EXCEPTION: main
  05-09 11:40:06.459: E/AndroidRuntime(544): java.lang.NullPointerException
  05-09 11:40:06.459: E/AndroidRuntime(544):  at PFD.agence_d_allocation.Les_agences$1.onPreExecute(Les_agences.java:94)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.os.AsyncTask.execute(AsyncTask.java:511)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at PFD.agence_d_allocation.Les_agences.connecter(Les_agences.java:204)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at PFD.agence_d_allocation.Les_agences.onCreateView(Les_agences.java:56)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:490)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.view.ViewPager.populate(ViewPager.java:1072)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.view.ViewPager.populate(ViewPager.java:918)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1440)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.View.measure(View.java:12723)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:812)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.View.measure(View.java:12723)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.View.measure(View.java:12723)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.View.measure(View.java:12723)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.View.measure(View.java:12723)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.os.Handler.dispatchMessage(Handler.java:99)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.os.Looper.loop(Looper.java:137)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at android.app.ActivityThread.main(ActivityThread.java:4424)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at java.lang.reflect.Method.invokeNative(Native Method)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at java.lang.reflect.Method.invoke(Method.java:511)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  05-09 11:40:06.459: E/AndroidRuntime(544):  at dalvik.system.NativeStart.main(Native Method)
  05-09 11:40:06.478: I/dalvikvm(544): Wrote stack traces to '/data/anr/traces.txt'
  05-09 11:40:06.768: D/dalvikvm(544): GC_CONCURRENT freed 159K, 3% free 10645K/10951K, paused 39ms+24ms
  05-09 11:40:06.909: I/dalvikvm(544): threadid=3: reacting to signal 3
  05-09 11:40:06.918: I/dalvikvm(544): Wrote stack traces to '/data/anr/traces.txt'
  05-09 11:40:07.189: I/dalvikvm(544): threadid=3: reacting to signal 3
  05-09 11:40:07.218: I/dalvikvm(544): Wrote stack traces to '/data/anr/traces.txt'
  </code></pre>