title: Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
body: <p>i have the error that "java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference".i think maybe i forgot to appoint value for something, but i don't know what it is exactly.is there something wrong with my arrayadapter or arraylist?</p>
  
  <pre><code>package com.example.lyn.finalproject;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.PopupMenu;
  
  import java.util.ArrayList;
  
  /**
   * Created by lyn on 2016/10/22.
   */
  public class SecondActivity extends Activity {
      Button bn1;
      Button bn2;
      Button bn3;
      Button bn4;
      Button bn5;
      Button bn6;
      EditText etext1;
      EditText etext2;
      EditText etext3;
      EditText etext4;
      EditText etext5;
      EditText etext6;
      String cname1;
      String cname2;
      String cname3;
      String cname4;
      String cname5;
      String cname6;
      String ctime1;
      String ctime2;
      String ctime3;
      String ctime4;
      String ctime5;
      String ctime6;
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_second);
          etext1=(EditText) findViewById(R.id.adcourse1);
          etext2=(EditText) findViewById(R.id.adcourse2);
          etext3=(EditText) findViewById(R.id.adcourse3);
          etext4=(EditText) findViewById(R.id.adcourse4);
          etext5=(EditText) findViewById(R.id.adcourse5);
          etext6=(EditText) findViewById(R.id.adcourse6);
          bn1=(Button) findViewById(R.id.menub1);
          bn2=(Button) findViewById(R.id.menub2);
          bn3=(Button) findViewById(R.id.menub3);
          bn4=(Button) findViewById(R.id.menub4);
          bn5=(Button) findViewById(R.id.menub5);
          bn6=(Button) findViewById(R.id.menub6);
          //为每一个按钮绑定popupMenu,并且接收用户点击的课程时间信息
          bn1.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  PopupMenu menu1=new PopupMenu(SecondActivity.this,bn1);
                             menu1.getMenuInflater().inflate(R.menu.time_choose_menu,
  menu1.getMenu());
              menu1.setOnMenuItemClickListener(new     PopupMenu.OnMenuItemClickListener() {
                      @Override
                      public boolean onMenuItemClick(MenuItem menuItem) {
                          ctime1=menuItem.getTitle()+"";
                          Log.d("TAG",ctime1);
                          return true;
                      }
                  });
                  menu1.show();
              }
          });
          bn2.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  PopupMenu menu2=new PopupMenu(SecondActivity.this,bn2);
                  menu2.getMenuInflater().inflate(R.menu.time_choose_menu,menu2.getMenu());
                  menu2.setOnMenuItemClickListener(new     PopupMenu.OnMenuItemClickListener() {
                      @Override
                      public boolean onMenuItemClick(MenuItem menuItem) {
                          ctime2=menuItem.getTitle()+"";
                          Log.d("TAG",ctime2);
                          return true;
                      }
                  });
          menu2.show();
              }
          });
     bn3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              PopupMenu menu3=new PopupMenu(SecondActivity.this,bn3);
              menu3.getMenuInflater().inflate(R.menu.time_choose_menu,menu3.getMenu());
              menu3.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                  @Override
                  public boolean onMenuItemClick(MenuItem menuItem) {
                      ctime3=menuItem.getTitle()+"";
                      Log.d("TAG",ctime3);
                      return true;
                  }
              });
              menu3.show();
          }
      });
      bn4.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              PopupMenu menu4=new PopupMenu(SecondActivity.this,bn4);
              menu4.getMenuInflater().inflate(R.menu.time_choose_menu,menu4.getMenu());
              menu4.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                  @Override
                  public boolean onMenuItemClick(MenuItem menuItem) {
                      ctime4=menuItem.getTitle()+"";
                      Log.d("TAG",ctime4);
                      return true;
                  }
              });
              menu4.show();
          }
      });
      bn5.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              PopupMenu menu5=new PopupMenu(SecondActivity.this,bn5);
              menu5.getMenuInflater().inflate(R.menu.time_choose_menu,menu5.getMenu());
              menu5.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                  @Override
                  public boolean onMenuItemClick(MenuItem menuItem) {
                      ctime5=menuItem.getTitle()+"";
                      Log.d("TAG",ctime5);
                      return true;
                  }
              });
              menu5.show();
          }
      });
      bn6.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              PopupMenu menu6=new PopupMenu(SecondActivity.this,bn6);
              menu6.getMenuInflater().inflate(R.menu.time_choose_menu,menu6.getMenu());
              menu6.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                  @Override
                  public boolean onMenuItemClick(MenuItem menuItem) {
                      ctime6=menuItem.getTitle()+"";
                      Log.d("TAG",ctime6);
                      return true;
                  }
              });
              menu6.show();
          }
      });
      //接受用户输入的课程名称
      cname1=etext1.getText()+"";
      cname2=etext2.getText()+"";
      cname3=etext3.getText()+"";
      cname4=etext4.getText()+"";
      cname5=etext5.getText()+"";
      cname6=etext6.getText()+"";
      Button bn=(Button) findViewById(R.id.bn);
      bn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              ArrayList&lt;String&gt; courseName=new ArrayList&lt;String&gt;();
              courseName.add(0,cname1);
              courseName.add(1,cname2);
              courseName.add(2,cname3);
              courseName.add(3,cname4);
              courseName.add(4,cname5);
              courseName.add(5,cname6);
              ArrayList&lt;String&gt; courseTime=new ArrayList&lt;String&gt;();
              courseTime.add(0,ctime1);
              courseTime.add(1,ctime2);
              courseTime.add(2,ctime3);
              courseTime.add(3,ctime4);
              courseTime.add(4,ctime5);
              courseTime.add(5,ctime6);
              Intent intent=new  Intent(SecondActivity.this,ThirdActivity.class);
              intent.putStringArrayListExtra("list", courseName);
              intent.putStringArrayListExtra("list",courseTime);
              startActivity(intent);
          }
      });
  }
  
  }
  
  
  package com.example.lyn.finalproject;
  
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.Toast;
  
  import java.util.ArrayList;
  import java.util.List;
  
  /**
   * Created by lyn on 2016/10/23.
   */
  public class ThirdActivity extends Activity {
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_third);
      Intent intent1=getIntent();
      Intent intent2=getIntent();
      Log.d("TAG","HI");
      ArrayList&lt;String&gt; courseName=intent1.getStringArrayListExtra("courseName");
      ArrayList&lt;String&gt; courseTime=intent2.getStringArrayListExtra("courseTime");
      ArrayAdapter&lt;String&gt; adapter1=new ArrayAdapter&lt;&gt;(ThirdActivity.this,android.R.layout.simple_list_item_1,courseName);
      ArrayAdapter&lt;String&gt; adapter2=new ArrayAdapter&lt;&gt;(ThirdActivity.this,android.R.layout.simple_list_item_1,courseTime);
      ListView listView1=(ListView) findViewById(R.id.list_view1);
      ListView listView2=(ListView) findViewById(R.id.list_view2);
      listView1.setAdapter(adapter1);
      listView2.setAdapter(adapter2);
      }
  }
  </code></pre>
  
  <p>activity_third.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;ListView
      android:id="@+id/list_view1"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"&gt;
  &lt;/ListView&gt;
  &lt;ListView
      android:id="@+id/list_view2"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"&gt;
  &lt;/ListView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>