0
我有根源的手機。 我想以編程方式將數據/數據/ com.android.providers.telephony/databases/mmssms.db 文件複製到sd卡。如何以編程方式將sms數據庫從根源手機複製到SD卡
我收到錯誤,如 java.io.FileNotFoundException:/data/data/com.android.providers.telephony/databases/mmssms.db(拒絕)
請幫我... 。
請多關照......
我使用下面的代碼在SD卡複製數據庫 ' 嘗試{
File sd = Environment.getExternalStorageDirectory();
String path = Environment.getDataDirectory().getAbsolutePath();
File data = Environment.getDataDirectory();
String currentDBPath = "/data/com.android.providers.telephony/databases/mmssms.db";
String backupDBPath = "/bkup/mmssms.db";
File currentDB = new File(data, currentDBPath);
File backupDB = new File(sd, backupDBPath);
// Local database
InputStream input = new FileInputStream(currentDB);
// Path to the external backup
OutputStream output = new FileOutputStream(backupDB);
// transfer bytes from the Input File to the Output File
byte[] buffer = new byte[1024];
int length;
while ((length = input.read(buffer))>0) {
output.write(buffer, 0, length);
}
output.flush();
output.close();
input.close();
} catch (Exception e) {
// TODO: handle exception
Toast.makeText(this, e.getMessage().toString(), Toast.LENGTH_LONG).show();
}`
感謝您的快速反應洞。我在這部分是新手,所以我可以通過編程來完成這個任務嗎?我提到的路徑是我的手機中的短信數據庫的實際路徑。 – 2012-02-24 05:20:23
我自己做了:D,方法如上。 – dong221 2012-02-24 06:00:56
是的!!!!!!感謝哥們......你是gr8。我得到它的工作......感謝您的幫助.... – 2012-02-24 06:16:50