Skip to content Skip to sidebar Skip to footer

Android: Can't Find My Package Folder To Put The Database File In It?

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.sya

Solution 1:

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]));
  }
}

Solution 2:

It's in "/data/data/com.syariati.finalProject/databases".


Solution 3:

/data/data/com.syariati.finalProject/databases

. . . .


Post a Comment for "Android: Can't Find My Package Folder To Put The Database File In It?"