Its been many days I was finding difficult to check the data from DB present in phone internal memory. One solution was to pull 'mydatabase.sqlite' through the ADB but which requires a rooted device, one was to through Log.d(" ", " "); which is time consuming.
I have found one solution, just copy 'mydatabase.sqlite' database from your app (internal) to external memory.
Copy the same on your desktop and browse it with help Windows SQLite database browser
Copy the below code in your activity and pass the Source & Destination.
Don't forget to give write external memory permission
Please share if you know any other method.
I have found one solution, just copy 'mydatabase.sqlite' database from your app (internal) to external memory.
Copy the same on your desktop and browse it with help Windows SQLite database browser
Copy the below code in your activity and pass the Source & Destination.
public void copy(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}
Don't forget to give write external memory permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Please share if you know any other method.
a tutorial on this: http://www.anddev.it/index.php/topic,8179.0.html
ReplyDelete