从下载的文件android加载数据库

时间:2015-02-08 14:24:00

标签: java android database sqlite

    private void pullDatabase() {
    try {//standard filechannel download
        URL website = new URL(ip + "/questions.db");
        ReadableByteChannel rbc = Channels.newChannel(website.openStream());
        FileOutputStream fos = new FileOutputStream(new File(this.getFilesDir().getAbsolutePath() + "/questions.db"));
        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
    }catch(Exception e){
        e.printStackTrace();
    }
}

这是我用来从服务器中提取数据库的代码。如何在之后加载数据库?

0 个答案:

没有答案