title: onCreate vs onCreateView to integrate ActionBar-PullToRefresh
body: <p>[UPDATE]</p>
  
  <p>I have add onCreateView but now i get this error :</p>
  
  <pre><code>07-03 14:39:36.878: E/AndroidRuntime(30913): FATAL EXCEPTION: main
  07-03 14:39:36.878: E/AndroidRuntime(30913): java.lang.RuntimeException: Content has view with id attribute 'android.R.id.list' that is not a ListView class
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.app.ListFragment.ensureList(ListFragment.java:402)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.app.ListFragment.onViewCreated(ListFragment.java:203)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at com.rss.alsace.AlsaceNewsFragment.onViewCreated(AlsaceNewsFragment.java:68)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:843)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.app.BackStackRecord.run(BackStackRecord.java:635)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1399)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:426)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.os.Handler.handleCallback(Handler.java:615)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.os.Handler.dispatchMessage(Handler.java:92)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.os.Looper.loop(Looper.java:137)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at android.app.ActivityThread.main(ActivityThread.java:4921)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at java.lang.reflect.Method.invokeNative(Native Method)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at java.lang.reflect.Method.invoke(Method.java:511)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
  07-03 14:39:36.878: E/AndroidRuntime(30913):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I try to integrate <strong>ActionBar-PullToRefresh library</strong> (<a href="https://github.com/chrisbanes/ActionBar-PullToRefresh" rel="nofollow">https://github.com/chrisbanes/ActionBar-PullToRefresh</a>) in my android app.</p>
  
  <p>My app is build with a menu (Navigation Drawer) on the left. When the user choose an item in the menu, an fragment is displayed on the main panel of my app.</p>
  
  <p><strong>Each fragment extends ListFragment.</strong> I try today to integrate ActionBar-PullToRefresh in these fragments.</p>
  
  <p>Folowing the <a href="https://github.com/chrisbanes/ActionBar-PullToRefresh/blob/master/samples/stock/src/uk/co/senab/actionbarpulltorefresh/samples/stock/FragmentTabsActivity.java" rel="nofollow">documentation</a> of the library, <strong>i must integrate these line in onCreateView</strong> :</p>
  
  <pre><code> @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                  Bundle savedInstanceState) {
              // Inflate the layout
              View view = inflater.inflate(R.layout.layout_fragment, container, false);
  
              // The ScrollView is what we'll be listening to for refresh starts
              ScrollView scrollView = (ScrollView) view.findViewById(R.id.ptr_scrollview);
  
              // Now get the PullToRefresh attacher from the Activity. An exercise to the reader
              // is to create an implicit interface instead of casting to the concrete Activity
              mPullToRefreshAttacher = ((FragmentTabsActivity) getActivity())
                      .getPullToRefreshAttacher();
  
              // Now set the ScrollView as the refreshable view, and the refresh listener (this)
              mPullToRefreshAttacher.setRefreshableView(scrollView, this);
  
              // Set title in Fragment for display purposes.
              TextView title = (TextView) view.findViewById(R.id.tv_title);
              title.setText(mTitle);
  
              return view;
          }
  </code></pre>
  
  <p>The problem is that in my class ListFragment, i only have onCreate method.</p>
  
  <p>What can i use to integrate onCreateView method ?</p>
  
  <p>Here is the compleete code of my class :</p>
  
  <pre><code>package com.rss.alsace;
  
  import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher;
  
  import com.rss.utils.WebBrowserViewActivity;
  
  import android.app.ListFragment;
  import android.content.Intent;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.ListView;
  
  
  public class AlsaceNewsFragment extends ListFragment implements PullToRefreshAttacher.OnRefreshListener {
  
      private static final String STATE_ACTIVATED_POSITION = "activated_position";
      //private List&lt;String&gt; item = new ArrayList&lt;String&gt;();
      private int mActivatedPosition = ListView.INVALID_POSITION;
      private RssServiceAlsace rssService;
      private static final String URL_LALSACE = "http://www.lalsace.fr/actualite/alsace/rss";
  
      private PullToRefreshAttacher mPullToRefreshAttacher;
  
      public AlsaceNewsFragment() {
          // Empty constructor required for fragment subclasses
      }
  
      // Allow Activity to pass us it's PullToRefreshAttacher
      void setPullToRefreshAttacher(PullToRefreshAttacher attacher) {
          mPullToRefreshAttacher = attacher;
      }
  
      public void onRefreshStarted(View view) {
          /**
           * Simulate Refresh with 4 seconds sleep
           */
          new AsyncTask&lt;Void, Void, Void&gt;() {
  
              @Override
              protected Void doInBackground(Void... params) {
                  refreshList();
                  return null;
              }
  
              @Override
              protected void onPostExecute(Void result) {
                  super.onPostExecute(result);
  
                  // Notify PullToRefreshAttacher that the refresh has finished
                  mPullToRefreshAttacher.setRefreshComplete();
              }
          }.execute();
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);    
          refreshList();
      }
  
  
      @Override
      public void onViewCreated(View view, Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
          if (savedInstanceState != null &amp;&amp; savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
              setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
          }
      }
  
      public void setActivatedPosition(int position) {
          if (position == ListView.INVALID_POSITION) {
              getListView().setItemChecked(mActivatedPosition, false);
          } else {
              getListView().setItemChecked(position, true);
          }
          mActivatedPosition = position;
      }
  
      private void refreshList(){
          rssService = new RssServiceAlsace(this);
          rssService.execute(URL_LALSACE);
      }
  
      @Override
      public void onListItemClick(ListView l, View v, int position, long id) {
          // Do something with the data
          Log.d("DernieresNewsFragment", "Item cliqué ! Position=" +position);
          Intent intent = new Intent(getActivity(), WebBrowserViewActivity.class);
          ArticleAlsace article = (ArticleAlsace) this.getListAdapter().getItem(position);
          Log.d("DernieresNewsFragment", "Url chargée=" +article.getUrl());
          intent.putExtra("URL", article.getUrl());
          startActivity(intent);
      }
  
  }
  </code></pre>