/**
 * Delete TraceFiles
 * Class to delete files from our phone
 * Built on Eclipse for Linux, Ubuntu 12.04 LTS
 * By:	Ramon Luis De Jesus
 * On:	Jun 12, 2013	11:30am
 */
package gov.nist.androidsuite;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import android.os.AsyncTask;
import android.os.Environment;

public class DeleteTraceFiles {
	public String Output = "";

	public void Start() {
		try {
			new AsyncTask<String, Void, Boolean>() {
				@Override
				protected Boolean doInBackground(String... params) {
					
					if (MainActivity.TracesDirectory.isDirectory()) {
				        String[] children = MainActivity.TracesDirectory.list();
				        for (int i = 0; i < children.length; i++) {
				            new File(MainActivity.TracesDirectory, children[i]).delete();
				        }
				    }	
					
					return null;
				}
				@Override
				protected void onPostExecute(Boolean result) {
					MainActivity.DeleteCompleted();
					super.onPostExecute(result);
				}
			}.execute("");

		} catch (Exception e) {
		}
	}
}
