title: Java how to split text which is read from sdcard file into different arrays
body: <p>I'm doing a school assignment and need some help.</p>
  
  <p>Android
  I have these coordinates stored in txt file in my sdcard, They are stored in this way</p>
  
  <pre><code>x.xxxxxxxx|x.xxxxxxxxxy
  x.xxxxxxxx|x.xxxxxxxxxx
  </code></pre>
  
  <p>and so on.
  What I'm doing is trying to use listview.onclicklistener(){, so once I tap on a file, it will read this and send a intent to the map with the data with it. What I want is to store it in a two different array such as Longitude[] and Latitude[] from the same file to send over to the map.class to use as parameters for creating markers. I know how to split it but I have no idea how to store them into individual arrays.</p>
  
  <pre><code>    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) {
              File logFile = new File(Environment.getExternalStorageDirectory().toString(), "GPSLogger/testfile.txt");
              InputStream instream = null;
              try {
                  instream = new FileInputStream(logFile);
              } catch (FileNotFoundException e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
              }
              BufferedReader reader = new BufferedReader(new InputStreamReader(instream));
              String line = null;
              String[] Location = null;
              int i = 0;
              String[] Longitude = null;
              String[] Latitude = null;
  
              try {
                  while((line = reader.readLine()) != null){
                      Log.v("result" ,result);
                      result += line + "|";
  
                      Location = result.split("\\|");
                      for (String s : Location) {
                          Log.v("asd",s);
                          i++;
                          if(i%2==0){
                              String[] Longitude = Location[0];
  
                          }
                          else{
                              String Latitude = Location[0];
                          }
                      }
  </code></pre>
  
  <p>This is what I'm trying but I'm getting quite a few error. Please help and thanks in advance!</p>