title: notifyDataSetChanged() on a null object reference
body: <p>I use startActivityForResult to start another activity to input some information, and then pass the intent back. Here is the partial code extend ListActivity:</p>
  
  <pre><code>private ArrayList&lt;Book&gt; shoppingCart = new ArrayList&lt;Book&gt;();
  ViewHolderAdapter viewHolderAdapter = null;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      // TODO check if there is saved UI state, and if so, restore it (i.e. the cart contents)
  
      if (shoppingCart.isEmpty())
          getListView().setEmptyView(findViewById(android.R.id.empty));
      else
      {
          viewHolderAdapter = new ViewHolderAdapter(this, R.layout.cart_row, shoppingCart);
          setListAdapter(viewHolderAdapter);
      }
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      super.onCreateOptionsMenu(menu);
      MenuInflater menuInflater = getMenuInflater();
      menuInflater.inflate(R.menu.bookstore_menu, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      super.onOptionsItemSelected(item);
      switch (item.getItemId())
      {
          case R.id.add:
              Intent intent = new Intent(this, AddBookActivity.class);
              startActivityForResult(intent, ADD_REQUEST);
              return true;
  
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode,
          Intent intent) {
      super.onActivityResult(requestCode, resultCode, intent);
  
      if(requestCode == ADD_REQUEST) {
          if (resultCode == RESULT_OK) {
          //  Log.d(TAG, "*************************************");
              Bundle data = intent.getExtras();
              Book book = (Book) data.getParcelable("book");
              shoppingCart.add(book);
  
              viewHolderAdapter.notifyDataSetChanged();
          }
      }
  
  }
  </code></pre>
  
  <p>However, their is an error:</p>
  
  <pre><code>Attempt to invoke virtual method 'void edu.stevens.cs522.bookstore.activities.BookStoreActivity$ViewHolderAdapter.notifyDataSetChanged()' on a null object reference
  </code></pre>
  
  <p>this is the button which send intent back:</p>
  
  <pre><code>Button add_btn = (Button) findViewById(R.id.add_one);
      add_btn.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              Intent intent = getIntent();
              EditText titleView = (EditText) findViewById(R.id.search_title);
              EditText authorView = (EditText) findViewById(R.id.search_author);
              EditText isbnView = (EditText) findViewById(R.id.search_isbn);
              EditText priceView = (EditText) findViewById(R.id.search_price);
  
              String author_str = authorView.getText().toString();
              String[] split_str = author_str.split("\\s+");
              Author author = null;
              if (split_str.length == 2) {
                  author = new Author(split_str[0], split_str[1]);
              }
              if (split_str.length == 3) {
                  author = new Author(split_str[0], split_str[1], split_str[2]);
              }
  
              String title = titleView.getText().toString();
              String isbn = isbnView.getText().toString();
              String price = priceView.getText().toString();
  
              intent.putExtra("book", new Book(title, author, isbn, price));
              setResult(Activity.RESULT_OK,intent);
              finish();
          }
      });
  </code></pre>
  
  <p>Thanks in advance.</p>