定制网站开发公司电话,上海装修公司排名2021,做平台的网站,门户网站 架构我正在使用Netbeans和java开发我的android应用程序.当我使用模拟器时,我可以通过访问以下路径,data / data / com.example.helloandroid / database来访问File explorer并将SQLite数据库插入设备内部存储器但是当我使用真实设备时,我无法访问此位置以将SQLite文件推送到手机的内…我正在使用Netbeans和java开发我的android应用程序.当我使用模拟器时,我可以通过访问以下路径,data / data / com.example.helloandroid / database来访问File explorer并将SQLite数据库插入设备内部存储器但是当我使用真实设备时,我无法访问此位置以将SQLite文件推送到手机的内部存储(位置).有人可以帮我如何将文件添加到手机内部存储.谢谢解决方法:我认为该设备没有root权限,这就是你无法访问它的原因.如果你想通过编程方式在你的应用程序中进行,那么它是可能的.如果有人知道的话请分享一下.编辑好的,首先,1. copy your Database.db file in your projects assets folder.2. now using code copy database file from /asset to devices internal storage(data/data//database folder).对于代码下使用的复制文件,try {// Open your local db as the input streamInputStream myInput myContext.getAssets().open(your database file name);// Path to the just created empty dbString outFileName /data/data//databases/;OutputStream myOutput new FileOutputStream(outFileName);// transfer bytes from the inputfile to the outputfilebyte[] buffer new byte[1024];int length;while ((length myInput.read(buffer)) 0){myOutput.write(buffer, 0, length);}// Close the streamsmyOutput.flush();myOutput.close();myInput.close();}catch (Exception e){Log.e(error, e.toString());}标签android来源 https://codeday.me/bug/20190723/1515201.html