Reputation: 365
I am new in using File Explorer in eclipse as well as Android.
I have created a database using SQLite
and added few data. The database is named dbtaxi.
My package name is com.syariati.finalProject
Then I saved this device database onto my desktop to help me check its content using SQLite Manager
, firefox addons
. Then I have added some data using SQLite Manager, which is possible is causing the problem.
My requirement is to replace database in my package (com.syariati.finalProject/Databases/dbtaxi
) with dbtaxi
on my Desktop. But, I can't find the path com.syariati.finalProject
.
Need help! Thank you.
Upvotes: 0
Views: 1441
Reputation: 59268
Your db is in a private folder "data/data/com.syariati.finalProject/databases/dbtaxi"
. You cannot access that folder without rooting the phone.
Another option is to copy the db to that folder programatically.
import java.io.*;
import java.nio.channels.*;
public class FileUtils{
public static void copyFile(File in, File out)
throws IOException
{
FileChannel inChannel = new
FileInputStream(in).getChannel();
FileChannel outChannel = new
FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(),
outChannel);
}
catch (IOException e) {
throw e;
}
finally {
if (inChannel != null) inChannel.close();
if (outChannel != null) outChannel.close();
}
}
public static void main(String args[]) throws IOException{
FileUtils.copyFile(new File(args[0]),new File(args[1]));
}
}
Upvotes: 2
Reputation: 1610
It's in "/data/data/com.syariati.finalProject/databases".
Upvotes: 0