title: ArrayAdapter possibly causes app to crash
body: <p>I am having a problem moving forward with my app. I just started developing the app and only have about 15 hours involved so far. But I have hit a snag. Usually I am able to google snags and most of my answers come from this forum!</p>
  
  <p>so I hope I can find a solution for this. Below is my activity java file. This is where the issue is as it was working fine before. I have been having a ton of trouble with showing my list using an array adapter. </p>
  
  <pre><code>public class Favorites extends Activity{
  UserFunctions userFunctions  = new UserFunctions();
  ArrayList&lt;String&gt; zipcodes = new ArrayList&lt;String&gt;(0);
  ArrayAdapter&lt;String&gt; arrayAdapter1 =      
           new ArrayAdapter&lt;String&gt;(this,android.R.layout.activity_list_item,zipcodes);
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.favoritespage);
  
      new DownloadDataTask().execute();
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.activity_main_screen, menu);
      return true;
  }
  
     private class DownloadDataTask extends AsyncTask&lt;JSONArray, JSONArray, ArrayList&lt;String&gt; &gt; {
  
  
          @Override
          protected ArrayList&lt;String&gt; doInBackground(JSONArray... params) {
              JSONArray json = userFunctions.ziplistrequest("37.5", "140.45", "20");
  
              for(int i=0; i &lt; json.length() ; i++) {
                  JSONObject jarray = null;
                  try {
                      jarray = json.getJSONObject(i);
                      String zip = jarray.getString("ZIPCODE");
                      zipcodes.add(zip);
                      arrayAdapter1.add(zip);
                      Log.d(zip,"Output");
                  } catch (JSONException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
              }
              return zipcodes;
          }   
          protected void onPostExecute(){
              ListView listView = (ListView) findViewById(R.id.listView1);
              listView.setAdapter(arrayAdapter1);
          }
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Now I do not know what is causing my problem exactly. I have tried googling individual parts of the trace to no avail. I find many articles on it but each one presents it completely different than I have mine so their solution does not work for me. Below is the trace.</p>
  
  <pre><code>01-29 07:55:47.753: E/AndroidRuntime(3723): FATAL EXCEPTION: main
  01-29 07:55:47.753: E/AndroidRuntime(3723): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.lo/com.example.lo.Favorites}: java.lang.IllegalStateException: System services not available to Activities before onCreate()
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.os.Handler.dispatchMessage(Handler.java:99)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.os.Looper.loop(Looper.java:137)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.app.ActivityThread.main(ActivityThread.java:5039)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at java.lang.reflect.Method.invokeNative(Native Method)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at java.lang.reflect.Method.invoke(Method.java:511)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at dalvik.system.NativeStart.main(Native Method)
  01-29 07:55:47.753: E/AndroidRuntime(3723): Caused by: java.lang.IllegalStateException: System services not available to Activities before onCreate()
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.app.Activity.getSystemService(Activity.java:4463)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.widget.ArrayAdapter.init(ArrayAdapter.java:310)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.widget.ArrayAdapter.&lt;init&gt;(ArrayAdapter.java:104)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at com.example.lo.Favorites.&lt;init&gt;(Favorites.java:33)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at java.lang.Class.newInstanceImpl(Native Method)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at java.lang.Class.newInstance(Class.java:1319)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
  01-29 07:55:47.753: E/AndroidRuntime(3723):     ... 11 more
  </code></pre>
  
  <p>I will be trying to fix this in the meantime. I think I am the only one who would rather program than watch the superbowl :P</p>