title: ERROR: When changing from one activity to the other
body: <p>When switching from one activity to the next activity, I get a selection of errors. The activity being switched to uses a custom listview, and I suspect an error here is causing all of my problems. I wonder whether passing an empty arraylist to my custom adapter causes this, because it reads from a file, which could cause it to return null.</p>
  
  <p>This is my error (logcat from Eclipse):</p>
  
  <pre><code>01-02 06:13:26.239: E/File not found(1765): java.io.FileNotFoundException: 
  
  /data/data/com.example.partyorganiser/files/PeopleDetailsFile: open failed: ENOENT (No such file or directory)
  01-02 06:13:26.259: E/AndroidRuntime(1765): FATAL EXCEPTION: main
  01-02 06:13:26.259: E/AndroidRuntime(1765): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.partyorganiser/com.example.partyorganiser.AddParty_PeopleList}: java.lang.ClassCastException: java.lang.Object[] cannot be cast to com.example.partyorganiser.PeopleDetails[]
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.os.Handler.dispatchMessage(Handler.java:99)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.os.Looper.loop(Looper.java:137)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.app.ActivityThread.main(ActivityThread.java:5103)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at java.lang.reflect.Method.invokeNative(Native Method)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at java.lang.reflect.Method.invoke(Method.java:525)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at dalvik.system.NativeStart.main(Native Method)
  01-02 06:13:26.259: E/AndroidRuntime(1765): Caused by: java.lang.ClassCastException: java.lang.Object[] cannot be cast to com.example.partyorganiser.PeopleDetails[]
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at com.example.partyorganiser.AddParty_PeopleList.onCreate(AddParty_PeopleList.java:37)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.app.Activity.performCreate(Activity.java:5133)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
  01-02 06:13:26.259: E/AndroidRuntime(1765):     ... 11 more
  </code></pre>
  
  <p>Thanks for the help!! :)</p>
  
  <p>EDIT: Code snippet:</p>
  
  <pre><code>package com.example.partyorganiser;
  
  import java.io.BufferedReader;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.util.ArrayList;
  
  import android.R.string;
  import android.os.Bundle;
  import android.app.Activity;
  import android.util.Log;
  import android.view.Menu;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  public class AddParty_PeopleList extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          ListView people_listview = (ListView) findViewById(R.layout.person_list_item);
          setContentView(R.layout.activity_add_party__people_list);
          ArrayList&lt;PeopleDetails&gt; people_list = Readpeopledetails();
  
  
          if(people_list != null){
              final peoplelist_customadapter adapter = new peoplelist_customadapter(this, R.layout.person_list_item,  people_list );
              people_listview.setAdapter(adapter);
          }
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.add_party__people_list, menu);
          return true;
      }
      public ArrayList&lt;PeopleDetails&gt; Readpeopledetails(){
          String filereadfrom = "";///declares a string to read file contents into. then split into peopledetails.
  
          ///this was copied straight from AddPeople. Could place in another static class, and then access it from both, but this was a very quick
          ///quite untidy way of doing it.
          ArrayList&lt;PeopleDetails&gt; peopledetails_array = new ArrayList&lt;PeopleDetails&gt;();
  
  
          try{
              InputStream filestream = openFileInput("PeopleDetailsFile");
              if (filestream != null){
                  InputStreamReader inputStreamReader = new InputStreamReader(filestream);
                  BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
                  String receiveString = "";
                  StringBuilder stringBuilder = new StringBuilder();
  
                  while ( (receiveString = bufferedReader.readLine()) != null ) {
                      stringBuilder.append(receiveString);
  
                  }
                  filereadfrom = stringBuilder.toString();
                  ///using two delimiters: ";" and ","
                  ///split based on ";" to get people as a string, put in array
  
                  String[] parsearray = filereadfrom.split(";");
  
  
                      for(String personstring: parsearray){
                          String[] split = personstring.split(",");
  
  
      PeopleDetails peopledetails_unit = new PeopleDetails("", "");
  
                          peopledetails_unit.name= split[0];
                          peopledetails_unit.number = split[1];
                          peopledetails_array.add(peopledetails_unit);
  
  
                  }
                  filestream.close();
                  inputStreamReader.close();
  
  
  
                  return peopledetails_array; }
          }
  
  
  
  
  
              catch(FileNotFoundException e) {
                  Log.e("File not found" , e.toString());
                  return peopledetails_array;
  
                  }
  
              catch(IOException e){
                  Log.e("Can't read file" , e.toString());///this is useful 
  
      for debugging, to figure out the problem.
  
                  return peopledetails_array;
  
  
  
              }
          return peopledetails_array;
  
  
  
      }
  
  }
  </code></pre>