package com.prolificinteractive.parallaxproject;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.prolificinteractive.parallaxpager.ParallaxContainer;

public class ParallaxFragment extends Fragment {

  @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_parallax, container, false);

    // find the parallax container
    ParallaxContainer parallaxContainer = (ParallaxContainer) view.findViewById(
        R.id.parallax_container);

    if (parallaxContainer != null) {
      // specify whether pager will loop
      parallaxContainer.setLooping(true);

      // wrap the inflater and inflate children with custom attributes
      parallaxContainer.setupChildren(inflater,
          R.layout.parallax_view_1,
          R.layout.parallax_view_2,
          R.layout.parallax_view_3,
          R.layout.parallax_view_4);
    }

    view.findViewById(R.id.btn_new_frag).setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        getFragmentManager().beginTransaction()
            .replace(android.R.id.content, new Fragment())
            .addToBackStack("test")
            .commit();
      }
    });

    return view;
  }
}

@@ -582,16 +582,24 @@
 tainer =
+%0A       
  (Parall
@@ -629,25 +629,16 @@
 iewById(
-%0A        
 R.id.par
@@ -660,47 +660,8 @@
 );%0A%0A
-    if (parallaxContainer != null) %7B%0A  
     
@@ -695,26 +695,24 @@
 ll loop%0A    
- 
- 
 parallaxCont
@@ -736,18 +736,16 @@
 true);%0A%0A
-  
     // w
@@ -805,18 +805,16 @@
 ributes%0A
-  
     para
@@ -851,34 +851,32 @@
 flater,%0A        
-  
 R.layout.paralla
@@ -885,18 +885,16 @@
 view_1,%0A
-  
         
@@ -919,34 +919,32 @@
 view_2,%0A        
- 
- 
 R.layout.paralla
@@ -953,18 +953,16 @@
 view_3,%0A
-  
         
@@ -987,22 +987,16 @@
 view_4);
-%0A    %7D
 %0A%0A    vi

remove null check