title: Pass ArrayList<String> with onActitityResult
body: <p>i have a custom Gallery where i can select Images and write the Path of the Images to an ArrayList. The Custom Gallery is called from my MainActivity class with an onActivityResult Intent. The Problem is that in my Custom Galery the ArrayList is correctly (when i select 4 images I get 4 Strings with the Imagepath in the ArrayList), but when i pass the ArrayList from the Galery back to the MainActivity i only have 1 ImagePath left in the ArrayList... hope you can help me...</p>
  
  <p>Start the activity in MainActivity.java</p>
  
  <pre><code>Intent in = new Intent(getApplicationContext(), AndroidCustomGalleryActivity.class);
  startActivityForResult(in, 500);
  </code></pre>
  
  <p>Fill the ArrayList in the Custom Gallery and send back the Intent to Main</p>
  
  <pre><code>final Button selectAll = (Button) findViewById(R.id.selectAll);
      selectAll.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
  
              final int thmbnls = thumbnailsselection.length;
              //CheckBox cb = (CheckBox)findViewById(R.id.itemCheckBox);
              //int cbId = cb.getId();
  
              all = true;
              String allstring = String.valueOf(all);
              Log.d("BOOLONCLICK", allstring);
  
              for(int i =0; i&lt;thmbnls; i++)
              {
                  thumbnailsselection[i] = true;
  
                  path = new ArrayList&lt;String&gt;();
                  path.add(arrPath[i]);
                  String test = path.toString();
                  Log.d("ArrayList", test);
                  pfade = path.toArray(new String[path.size()]);
              }
  
              Intent intent = new Intent();
              intent.putStringArrayListExtra("values", path);
              setResult(RESULT_OK, intent);
              finish();
          }
      });
  </code></pre>
  
  <p>Receive the Intent in Main: </p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  
      switch(requestCode){
      case 500:
          if(resultCode == RESULT_OK){
  
  
              pfade = (ArrayList&lt;String&gt;) data.getStringArrayListExtra("values");
              //Log.d("SINGLEPFADE", pfade[0]);
              //filePath = (TextView)findViewById(R.id.idTxtImagePath);
              //int bilder = pfade.size();
              String test = pfade.toString();
              //filePath.setText(bilder);
              //String test = String.valueOf(bilder);
              Log.d("AnzahlBilder", test);
          }
          break;
      }
  
  
  }
  </code></pre>