现在在做一个电信营业厅信息展示的项目,服务器端提供一个db数据库的下载地址,android客户端需要下载并读取这个数据库里的一些信息,请问是直接将数据库下载到sd卡中,然后在代码中去直接去操作这个数据库,还是需要一些其他的处理。还有在每次登陆的时候,需要更新数据库,请问如何实现,能给个思路最好了!还有就是我写的这个方法对不对,怎么没有下载成功呢?下载后缀名.db的数据库没有什么特别要求吧。求大神们能耐心的看一下。谢谢public void downFile(String url, String path, String fileName)  
 
throws IOException {  
 
if (fileName == null || fileName == "")  
 
this.FileName = url.substring(url.lastIndexOf("/") + 1);  
 
else  
 
this.FileName = fileName; // 取得文件名,如果输入新文件名,则使用新文件名  
 
  
 
URL Url = new URL(url);  
 
URLConnection conn = Url.openConnection();  
 
conn.connect();  
 
InputStream is = conn.getInputStream();  
 
this.fileSize = conn.getContentLength();// 根据响应获取文件大小  
 
if (this.fileSize <= 0) { // 获取内容长度为0  
 
throw new RuntimeException("无法获知文件大小 ");  
 
}  
 
if (is == null) { // 没有下载流  
   
throw new RuntimeException("无法获取文件");  
 
}  
 
FileOutputStream FOS = new FileOutputStream(path + this.FileName); // 创建写入文件内存流,通过此流向目标写文件  
 
  
 
byte buf[] = new byte[1024];  
   
  
 
int numread;  
 
  
 
while ((numread = is.read(buf)) != -1) {  
 
FOS.write(buf, 0, numread);  
   
   
 
}   
 
try {  
 
is.close();  
 
} catch (Exception ex) {  
 
   
 
}  
 
  
 
}