Back to project page GestureMechanism.
The source code is released under:
GNU Lesser General Public License
If you think the Android project GestureMechanism listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *// www . j a va 2 s .c o m * Please send inquiries to huber AT ut DOT ee */ package com.in.mobile.database.adcontainer; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Calendar; /** * * @author Huber Flores * */ public class DatabaseCommons { private String outFileName; private static final String app_package = "com.in.mobile.gesture.ad"; private static final String fileName = "ads-data.db"; private String absoluteFilePath; public DatabaseCommons() { } public void copyDatabaseFile() throws IOException { absoluteFilePath = "/data/data/" + app_package + "/databases/" + fileName; InputStream myInput = new FileInputStream(absoluteFilePath); Calendar calendar = Calendar.getInstance(); this.outFileName = "/sdcard/" + fileName + calendar.getTimeInMillis() + ".sql"; OutputStream myOutput = new FileOutputStream(outFileName); byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer)) > 0) { myOutput.write(buffer, 0, length); } myOutput.flush(); myOutput.close(); myInput.close(); File borrar = new File(absoluteFilePath); borrar.delete(); } public boolean fileToCopy() { File check = new File(absoluteFilePath); if (check.exists() == true) { return true; } else { return false; } } public String getDataBasePath() { return this.outFileName; } public void deleteDatabaseFile() { File borrar = new File(absoluteFilePath); borrar.delete(); } }