Save a Layout with Changing values in a loop on sdcard in android
<p>Hi i have a loop which iterates to save a layout with changing values, For every iteration the values in the xml are different and is supposed to be saved when the user click on save button. </p>

<pre><code>       String [] sizes = {"A","B","C","D"};
        for (int i = 0; i &lt;= sizes.length-1 ; i++){
            try {
                String x = sizes[i];
                Intent intents = new Intent();
                intents.setClass(Sizes.this, Sizes.class);

                Bundle bundles = new Bundle();
                bundles.putCharSequence("sizes", x);
                intents.putExtras(bundles);
                startActivity(intents);
                doSave();

            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
</code></pre>

<p>Every size loads different values and i need to save the layouts for all the values in the loop on the sdcard. My doSave(): </p>

<pre><code>         public void doSave() throws IOException, InterruptedException {

    RelativeLayout imagevw =(RelativeLayout)findViewById(R.id.sizelayout);
    Bitmap b = Bitmap.createBitmap(imagevw.getWidth(), imagevw.getHeight(), Bitmap.Config.ARGB_8888);

    int weight,height;

    weight =  imagevw.getWidth();

    height =  imagevw.getHeight();

    Bitmap cs = Bitmap.createBitmap(weight, height, Bitmap.Config.ARGB_8888);

    Canvas c = new Canvas(cs);

    c.drawBitmap(b,0,0,null);

    imagevw.draw(c);

    String getDirPath = Environment.getExternalStorageDirectory().getAbsolutePath(); 
    File myDirPath = new File(getDirPath +"/Size");

    if(!myDirPath.exists()){

        myDirPath.mkdir();

    }

    File file1 = new File("/sdcard/size/"+size+"saved image.png");
FileOutputStream fos = new FileOutputStream(file1);

if (fos != null) {

cs.compress(Bitmap.CompressFormat.PNG, 90, fos);

fos.close();
    }

    }
</code></pre>

<p>When u save a single layout it saves well. The problem is when the loop completes it only saves the current layout with the current values before you click on save button. Meaning it is saving only the present layout. How can save a layout for each loop because they have different values. Note the "<strong><em>size</em></strong>+"saved image.png" <strong><em>size</em></strong> is a bundle in that instance.</p>
