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.*;

publicclassFileUtils{
    publicstaticvoidcopyFile(File in, File out)throws IOException 
    {
        FileChannelinChannel=newFileInputStream(in).getChannel();
        FileChanneloutChannel=newFileOutputStream(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();
        }
    }

    publicstaticvoidmain(String args[])throws IOException{
        FileUtils.copyFile(newFile(args[0]),newFile(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?"