Back to project page Cam2IMU_calib.
The source code is released under:
MIT License
If you think the Android project Cam2IMU_calib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package cvg.vslam.c2i_calib; /*from ww w . j a v a 2s . co m*/ import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; import java.io.File; /** * Created with IntelliJ IDEA. * User: fede * Date: 7/17/13 * Time: 6:44 PM * To change this template use File | Settings | File Templates. */ public class SaveDataDialog extends DialogFragment { private File storageDir; private MainActivity activity; public SaveDataDialog(File storageDir, MainActivity activity){ this.storageDir = storageDir; this.activity = activity; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage("Save gathered images/sensor readings?") .setPositiveButton("Save", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { activity.finish(); } }) .setNegativeButton("Discard", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { recursiveDelete(storageDir); activity.finish(); } }); return builder.create(); } private void recursiveDelete(File fileOrDirectory) { if (fileOrDirectory.isDirectory()) for (File child : fileOrDirectory.listFiles()) recursiveDelete(child); fileOrDirectory.delete(); } }