title: StartActivity crashes with RuntimeException: Unable to start activity ComponentInfo
body: <p>I'm trying to start new activity by button click.</p>
  
  <p>Main Activity code:</p>
  
  <pre><code>public class HelloScreenActivity extends Activity {
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          final Button btn_lang = (Button)findViewById(R.id.btn_lang_rus);
          btn_lang.setOnClickListener(new View.OnClickListener() {    
              public void onClick(View v) {
                  try
                  {
                      Intent intent = new Intent();
                      intent.putExtra("type", getString(R.string.routes));
                      intent.setClass(HelloScreenActivity.this, RoutesListActivity.class);
                      startActivity(intent);  
                  }
                  catch(Exception exc)
                  {
                      ShowMessage(exc.getMessage());  
                  }               
              }
          });
  
  }
  </code></pre>
  
  <p>Next activity code:</p>
  
  <pre><code>    public class RoutesListActivity extends Activity{
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.routes_list);
          Bundle extras = getIntent().getExtras(); 
          String type = (String) extras.get("type");
  
          ListView list = (ListView)findViewById(R.id.ent_list);
          ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;(null, 0);
          final String[] routes = {this.getString(R.string.greenline), this.getString(R.string.redline)};
          if(type == "Routes")
          {      
              arrayAdapter = new ArrayAdapter&lt;String&gt;
                  (this, android.R.layout.simple_list_item_1, routes);
              list.setAdapter(arrayAdapter);
          }
  
          list.setAdapter(arrayAdapter);
          list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
              public void onItemClick(AdapterView&lt;?&gt; parentView, View childView, int pos,
                      long id) {
                  try
                  {       
                      Intent intent = new Intent();
                      intent.putExtra("display", routes[pos]);
                      intent.setClass(RoutesListActivity.this, TheMapActivity.class);
                      startActivity(intent);  
                  }
                  catch(Exception exc)
                  {
                      ShowMessage(exc.getMessage());  
                  }               
              }
          });
      }
  
      }
  </code></pre>
  
  <p>When I press a button, app crashes (on <code>startActivity(intent)</code> call)</p>
  
  <p>Stack trace:</p>
  
  <pre><code>02-26 19:39:35.382: W/dalvikvm(19398): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
  02-26 19:39:35.493: E/AndroidRuntime(19398): FATAL EXCEPTION: main
  02-26 19:39:35.493: E/AndroidRuntime(19398): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thumbsupstudio.mobitour/com.thumbsupstudio.mobitour.RoutesListActivity}: java.lang.NullPointerException
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1872)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.app.ActivityThread.access$1500(ActivityThread.java:135)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.os.Handler.dispatchMessage(Handler.java:99)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.os.Looper.loop(Looper.java:150)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.app.ActivityThread.main(ActivityThread.java:4385)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at java.lang.reflect.Method.invokeNative(Native Method)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at java.lang.reflect.Method.invoke(Method.java:507)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at dalvik.system.NativeStart.main(Native Method)
  02-26 19:39:35.493: E/AndroidRuntime(19398): Caused by: java.lang.NullPointerException
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.view.ViewConfiguration.get(ViewConfiguration.java:230)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.view.View.&lt;init&gt;(View.java:1920)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.view.View.&lt;init&gt;(View.java:1969)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:314)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.widget.AdapterView.&lt;init&gt;(AdapterView.java:228)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.widget.AbsListView.&lt;init&gt;(AbsListView.java:605)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.widget.ListView.&lt;init&gt;(ListView.java:164)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.widget.ListView.&lt;init&gt;(ListView.java:160)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.widget.ListView.&lt;init&gt;(ListView.java:156)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at com.thumbsupstudio.mobitour.RoutesListActivity.onCreate(RoutesListActivity.java:18)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1836)
  02-26 19:39:35.493: E/AndroidRuntime(19398):    ... 11 more
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The problem was in <code>ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;(null, 0);</code> </p>
  
  <p>How to init ArrayAdapter correctly? </p>