title: Swipe Refresh Layout in Android Fragment
body: <p>Im trying to implement SwipeRefreshLayout on a Fragment.</p>
  
  <p>I already solved it to implement it on an Activity, but when I implement it on Fragment: java.lang.NoClassDefFoundError: com...</p>
  
  <p>Does anyone has an idea? Thanks!</p>
  
  <p>Similar post without answers/solution: <a href="https://stackoverflow.com/questions/24495952/swipe-refresh-layout-class-not-found">Swipe Refresh Layout - Class not found</a></p>
  
  <p>My code:</p>
  
  <pre><code>public class Principal extends Fragment implements OnRefreshListener {
      SwipeRefreshLayout swipeLayout;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
  
          // Inflate the layout for this fragment
          view = inflater.inflate(R.layout.principal, container, false);
  
          swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container);
          swipeLayout.setOnRefreshListener(this);
          swipeLayout.setColorScheme(android.R.color.holo_blue_bright, 
                  android.R.color.holo_green_light, 
                  android.R.color.holo_orange_light, 
                  android.R.color.holo_red_light);
  
          return view;
      }
  }
  </code></pre>
  
  <p>And my layout:</p>
  
  <pre><code>&lt;android.support.v4.widget.SwipeRefreshLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/swipe_container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;com.enhancedListView.EnhancedListView
          android:id="@+id/listaNoticias"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginLeft="6dp"
          android:layout_marginRight="6dp"
          android:layout_marginTop="5dp" &gt;
      &lt;/com.enhancedListView.EnhancedListView&gt;
  
  &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  </code></pre>
  
  <p>Full stack trace</p>
  
  <pre><code>08-13 11:36:19.292: E/AndroidRuntime(31572): FATAL EXCEPTION: main
  08-13 11:36:19.292: E/AndroidRuntime(31572): Process: com.xxx.xx, PID: 31572
  08-13 11:36:19.292: E/AndroidRuntime(31572): java.lang.NoClassDefFoundError: com.xxx.fragments.Principal
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at com.xxx.hem.activities.MainActivity.CargarPrincipal(MainActivity.java:676)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at com.xxx.hem.activities.MainActivity.onCreate(MainActivity.java:297)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.app.Activity.performCreate(Activity.java:5231)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.os.Handler.dispatchMessage(Handler.java:102)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.os.Looper.loop(Looper.java:136)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at android.app.ActivityThread.main(ActivityThread.java:5001)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at java.lang.reflect.Method.invoke(Native Method)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
  08-13 11:36:19.292: E/AndroidRuntime(31572):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
  </code></pre>