編輯:關於Android編程
private void copyDBToSDcrad()
{
String DATABASE_NAME = "數據庫文件名稱";
String oldPath = "data/data/com.packagename/databases/" + DATABASE_NAME;
String newPath = Environment.getExternalStorageDirectory() + File.separator + DATABASE_NAME;
copyFile(oldPath, newPath);
}
/**
* 復制單個文件
*
* @param oldPath
* String 原文件路徑
* @param newPath
* String 復制後路徑
* @return boolean
*/
public static void copyFile(String oldPath, String newPath)
{
try
{
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
File newfile = new File(newPath);
if (!newfile.exists())
{
newfile.createNewFile();
}
if (oldfile.exists())
{ // 文件存在時
InputStream inStream = new FileInputStream(oldPath); // 讀入原文件
FileOutputStream fs = new FileOutputStream(newPath);
byte[] buffer = new byte[1444];
while ((byteread = inStream.read(buffer)) != -1)
{
bytesum += byteread; // 字節數 文件大小
fs.write(buffer, 0, byteread);
}
inStream.close();
}
}
catch (Exception e)
{
System.out.println("復制單個文件操作出錯");
e.printStackTrace();
}
}
android導入第三方jar包報錯 如何正確導入jar包
在android上導入zxing.jar包,總是報錯:Could not find class com.google.zxing.MultiFormatWriter, r
小米手機(MIUI系統)怎麼在撥號界面查詢話費余額
如果你使用的是小米手機或者MIUI系統,你知道MIUI系統的撥號界面可以直接查詢你的手機話費余額嗎?這麼高大上的功能沒用過吧?還在撥打客服熱線、發送短信查詢
Android支付開發(微信)
微信接入支付流程跟支付寶差不多,這裡介紹一下接入流程以及注意事項。接入流程:1.1、到微信開放平台添加移動應用,申請權限到微信開放平台注冊開發者賬號,並添加應用,申請支付
快速解決Android平台移植ffmpeg的一些問題
IT行業是一個踩在巨人肩膀上前進的行業,否則做的事情不一定有意義,所以我也是基於havlenapetr移植的ffmpeg基礎上做了些改進,他做的主要貢獻有:1. 移植了f