title: Custom ListView in Fragment just appear when I rotate the Android Phone
body: <p>I have created an Fragment to be the main feed of my app. The list data(ArrayList) is loaded from the main activity through the inner interface in fragment that Activity implements.</p>
  
  <p>My problems:</p>
  
  <ol>
  <li>My custom ListView just is shown when I rotate de phone.</li>
  <li>OnCreateView and OnActivityCreate is called twice when I rotate.</li>
  <li>If ListView is shown after I rotate the phone and I click in, i get next error:</li>
  </ol>
  
  <blockquote>
    <p>java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView(2131034209, class android.widget.ListView) with Adapter(class com.fb.newcomersapp.CustomListAdapter)]</p>
  </blockquote>
  
  <p>That is my main fragment methods:</p>
  
  <pre><code>public void onActivityCreated(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onActivityCreated(savedInstanceState);
      listView = (ListView) getView().findViewById(R.id.event_list_view);
      mCallback.parseQueryEvents();
      ArrayList&lt;Event&gt; eventList = mCallback.getEventList();
      Log.d("FeedActivity", eventList.size()+"");
      CustomListAdapter adapter = new CustomListAdapter(getActivity(), eventList);
      listView.setAdapter(adapter);
  
      listView.setOnItemClickListener(new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int position, long id) {
              // TODO Auto-generated method stub
              mCallback.openEvent(position);
  
          }
      });
  
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      View view = inflater.inflate(R.layout.fragment_feed, container, false);
  
      textView = (TextView) view.findViewById(R.id.tv_header);
      textView.setText(mCallback.getLocal()); 
      return view;
  }
  </code></pre>
  
  <p>The main activity methods:</p>
  
  <pre><code>public void parseQueryEvents () {
      eventList = new ArrayList&lt;Event&gt;();
      ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("Event");
      query.orderByAscending("startDate") ;
      query.whereGreaterThanOrEqualTo("endDate", new Date()) ;
      query.findInBackground(new FindCallback&lt;ParseObject&gt;() {
          public void done(List&lt;ParseObject&gt; parseEventList, ParseException e) {
              if (e == null) {
                  ParseObject temp ;
                  Iterator&lt;ParseObject&gt; i = parseEventList.iterator() ;
                  while(i.hasNext()) {
                      temp = i.next();
                      eventList.add(new Event(temp)) ;
                  }
              } else {
                  Log.d("FeedActivity", e.getMessage());
              }
          }
      });
  }
  
  public ArrayList&lt;Event&gt; getEventList() {
      // TODO Auto-generated method stub
      return eventList;
  }
  </code></pre>
  
  <p>Log:</p>
  
  <blockquote>
    <p>02-04 13:36:06.844: D/GPS(7237): GPS
    02-04 13:36:07.110: D/FeedActivity(7237): 0
    02-04 13:36:07.145: D/GPS(7237): GPS
    02-04 13:36:07.409: D/FeedActivity(7237): 0
    02-04 13:36:07.420: I/Choreographer(7237): Skipped 39 frames!  The application may be doing too much work on its main thread.
    02-04 13:36:07.451: W/View(7237): requestLayout() improperly called by android.widget.ListView{42079068 IFED.VC. ......ID -360,0-0,778 #7f050041 app:id/list_slidermenu} during layout: running second layout pass</p>
  </blockquote>
  
  <p>So, anyone can help me? Thx :D</p>