title: Application with ViewPager crashes at start when I set onClickListener
body: <p>I've got a trouble. When I set onClickListener on a Button, the application simply doesn't start. I think that the promblem in wrong using ViewPager, but I can't find an answer in the Internet.   Please tell me what is wrong in simpliest way, because I am new in Java.</p>
  
  <pre><code>  public class MainActivity extends ActionBarActivity {
      CheckBox percentageBox;
      CheckBox numberBox;
          EditText editText;
          TextView textView;
          Button saveButton;
          Button generateButton;
          View.OnClickListener saveButtonListener;
          View.OnClickListener generateButtonListener;
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              LayoutInflater inflater = LayoutInflater.from(this);
              List&lt;View&gt; pages = new ArrayList&lt;View&gt;();
              View page1 = inflater.inflate(R.layout.passwordmanager, null);
              pages.add(page1);
              View page2 = inflater.inflate(R.layout.passwordgenerator, null);
              pages.add(page2);
  
              SamplePagerAdapter pagerAdapter = new SamplePagerAdapter(pages);
              ViewPager viewPager = new ViewPager(this);
              viewPager.setAdapter(pagerAdapter);
              viewPager.setCurrentItem(1);
              setContentView(viewPager);
              initializeApp();
          }
  
      public void initializeApp() {
  
          percentageBox = (CheckBox) findViewById(R.id.checkBox2);
          numberBox = (CheckBox) findViewById(R.id.checkBox);
          textView = (TextView) findViewById(R.id.textView2);   
          generateButton=(Button) findViewById(R.id.button);       
          generateButtonListener= new View.OnClickListener(){
              public void onClick(View v){
                  touchGenerateButton();
              }
          };
          generateButton.setOnClickListener(generateButtonListener);//Here is the problem
  
          private void touchGenerateButton() {
              textView.setText(getPasswordString(Integer.parseInt(editText.getText().toString()),numberBox.isChecked(),percentageBox.isChecked()));
          }
  </code></pre>
  
  <p>LogCat (if I added <code>setContentView(R.layout.activity_main);</code> in onCreate):</p>
  
  <pre><code>02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
  02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication W/dalvikvm﹕ VFY: unable to resolve virtual method 11346: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
  02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
  02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
  02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication W/dalvikvm﹕ VFY: unable to resolve virtual method 11352: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
  02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
  02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
  02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication W/dalvikvm﹕ VFY: unable to resolve virtual method 9040: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
  02-21 06:21:26.121    1697-1697/com.example.rinat.myapplication D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
  02-21 06:21:26.125    1697-1697/com.example.rinat.myapplication I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
  02-21 06:21:26.125    1697-1697/com.example.rinat.myapplication W/dalvikvm﹕ VFY: unable to resolve virtual method 364: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
  02-21 06:21:26.125    1697-1697/com.example.rinat.myapplication D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
  02-21 06:21:26.129    1697-1697/com.example.rinat.myapplication I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
  02-21 06:21:26.129    1697-1697/com.example.rinat.myapplication W/dalvikvm﹕ VFY: unable to resolve virtual method 386: Landroid/content/res/TypedArray;.getType (I)I
  02-21 06:21:26.129    1697-1697/com.example.rinat.myapplication D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
  02-21 06:21:26.141    1697-1697/com.example.rinat.myapplication D/dalvikvm﹕ GC_FOR_ALLOC freed 115K, 5% free 3702K/3888K, paused 4ms, total 4ms
  02-21 06:21:26.153    1697-1697/com.example.rinat.myapplication D/dalvikvm﹕ GC_FOR_ALLOC freed 25K, 6% free 3897K/4112K, paused 9ms, total 9ms
  02-21 06:21:26.161    1697-1697/com.example.rinat.myapplication I/dalvikvm-heap﹕ Grow heap (frag case) to 6.291MB for 2536932-byte allocation
  02-21 06:21:26.205    1697-1706/com.example.rinat.myapplication D/dalvikvm﹕ GC_FOR_ALLOC freed &lt;1K, 4% free 6375K/6592K, paused 52ms, total 52ms
  02-21 06:21:26.457    1697-1697/com.example.rinat.myapplication D/AndroidRuntime﹕ Shutting down VM
  02-21 06:21:26.457    1697-1697/com.example.rinat.myapplication W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa4ca3b20)
  02-21 06:21:26.541    1697-1697/com.example.rinat.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: com.example.rinat.myapplication, PID: 1697
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.rinat.myapplication/com.example.rinat.myapplication.MainActivity}: java.lang.NullPointerException
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
              at android.app.ActivityThread.access$800(ActivityThread.java:135)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:136)
              at android.app.ActivityThread.main(ActivityThread.java:5001)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: java.lang.NullPointerException
              at com.example.rinat.myapplication.MainActivity.initializeApp(MainActivity.java:68)
              at com.example.rinat.myapplication.MainActivity.onCreate(MainActivity.java:47)
              at android.app.Activity.performCreate(Activity.java:5231)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
              at android.app.ActivityThread.access$800(ActivityThread.java:135)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:136)
              at android.app.ActivityThread.main(ActivityThread.java:5001)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
              at dalvik.system.NativeStart.main(Native Method)
  </code></pre>