how do i perform method for all iteration of for loop
<p>my code just delete 1st file using button click but i want to delete and unhide all images using for loop if this statement is true  if(CheckArr[i] == true)  but my code just perform only first index file ot all checked file is  delete only 1st one is delete what do i do? how do i delete and copy all checked item? how do i customize my for loop??</p>

<pre><code>    unhide.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {

for (int i = 0; i &lt; CheckArr.length; i++) {
if (CheckArr[i] == true) {

db = new DataBase(getBaseContext());
    try {
    db.createDataBase();

      } catch (IOException e1) {

    e1.printStackTrace();
    }
  Cursor DataC = db .selectQuery("SELECT path FROM Photos where name ='"+ 
  currentFiles[i].getName() + "'");



Bitmap bitmap = decodeFile.decodeFile(new File(root + "/"+ currentFiles[i].getName()));

try {       
 FileOutputStream outputStream = new FileOutputStream(new 
 File(DataC.getString(DataC.getColumnIndex("path"))));

    outputStream.write(decodeFile.getBitmapAsByteArray(bitmap));
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}

File file = new File(root + "/" + currentFiles[i].getName());
file.delete();

inflateListView(currentFiles);


DataC.close();
   db.close();
}
}
</code></pre>
