title: Get String[] from the other class
body: <p>This is my main class:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  }
  
  Context con;
  
  protected void onClickCityBreak(View v) {
  
      String [] arrayCityBreak = con.getResources().getStringArray(R.array.citybreak);
      Intent myintent = new Intent(MainActivity.this, ActivityTo.class);
      myintent.putExtra("PLACES",arrayCityBreak);
      startActivity(myintent);
  }
  }
  </code></pre>
  
  <p>And this is the class i want to send myintent array to:</p>
  
  <pre><code>public class ActivityTo extends ListActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
  
      String[] arrayCityBreak = getIntent().getStringArrayExtra("PLACES");
  
      ArrayAdapter&lt;String&gt; adapterCityBreak = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, arrayCityBreak);
  
      ListView myview = getListView();
  
      myview.setAdapter(adapterCityBreak);
  
  }
  }
  </code></pre>
  
  <p>My AndroidManifest.xml file:</p>
  
  <pre><code>&lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;activity android:name=".ActivityTo"&gt;
  
      &lt;/activity&gt;
  </code></pre>
  
  <p>I can't find the problem in this. My application shuts down when i click the button to get to the new intent. It is because of the String[] i try to send, but I don't see why is won't work.</p>
  
  <pre><code>--------- beginning of crash
  E/AndroidRuntime: FATAL EXCEPTION: main
                Process: com.ivarrreyna.assignment, PID: 2626
                java.lang.IllegalStateException: Could not execute method for android:onClick
                    at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
                    at android.view.View.performClick(View.java:5198)
                    at android.view.View$PerformClick.run(View.java:21147)
                    at android.os.Handler.handleCallback(Handler.java:739)
                    at android.os.Handler.dispatchMessage(Handler.java:95)
                    at android.os.Looper.loop(Looper.java:148)
                    at android.app.ActivityThread.main(ActivityThread.java:5417)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                 Caused by: java.lang.reflect.InvocationTargetException
                    at java.lang.reflect.Method.invoke(Native Method)
                    at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
                    at android.view.View.performClick(View.java:5198) 
                    at android.view.View$PerformClick.run(View.java:21147) 
                    at android.os.Handler.handleCallback(Handler.java:739) 
                    at android.os.Handler.dispatchMessage(Handler.java:95) 
                    at android.os.Looper.loop(Looper.java:148) 
                    at android.app.ActivityThread.main(ActivityThread.java:5417) 
                    at java.lang.reflect.Method.invoke(Native Method) 
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                 Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
                    at com.ivarrreyna.assignment.MainActivity.onClickCityBreak(MainActivity.java:24)
                    at java.lang.reflect.Method.invoke(Native Method) 
                    at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288) 
                    at android.view.View.performClick(View.java:5198) 
                    at android.view.View$PerformClick.run(View.java:21147) 
                    at android.os.Handler.handleCallback(Handler.java:739) 
                    at android.os.Handler.dispatchMessage(Handler.java:95) 
                    at android.os.Looper.loop(Looper.java:148) 
                    at android.app.ActivityThread.main(ActivityThread.java:5417) 
                    at java.lang.reflect.Method.invoke(Native Method) 
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
  </code></pre>
  
  <p>Application terminated.</p>