String url="/data/data/com.dragon/adv/advert.dat";
File file =new File(url);
try{
if(!file.exists())
file.mkdirs();
file.delete();
file.createNewFile();
FileOutputStream dos=openFileOutput("advert.dat", MODE_PRIVATE);
String str="************* info===>>>>>>>>";
byte []content=str.getBytes();
dos.write(content);
dos.close();
dos.close();
FileInputStream fis=openFileInput("advert.dat");
int len=fis.available();
byte rad[]=new byte [len];
fis.read(rad);
fis.close();
String pr=new String(rad,"UTF-8");
System.out.println(""+pr);
}catch(Exception ex){
ex.printStackTrace();
}就这么个文件读写操作的问题 新建的android 工程里就可以正常的 写入,读取放到android项目里就报空指针。。ddms查看手机内存里也确实存在这个文件路径和文件...。 谁知道怎么回事啊
File file =new File(url);
try{
if(!file.exists())
file.mkdirs();
file.delete();
file.createNewFile();
FileOutputStream dos=openFileOutput("advert.dat", MODE_PRIVATE);
String str="************* info===>>>>>>>>";
byte []content=str.getBytes();
dos.write(content);
dos.close();
dos.close();
FileInputStream fis=openFileInput("advert.dat");
int len=fis.available();
byte rad[]=new byte [len];
fis.read(rad);
fis.close();
String pr=new String(rad,"UTF-8");
System.out.println(""+pr);
}catch(Exception ex){
ex.printStackTrace();
}就这么个文件读写操作的问题 新建的android 工程里就可以正常的 写入,读取放到android项目里就报空指针。。ddms查看手机内存里也确实存在这个文件路径和文件...。 谁知道怎么回事啊
解决方案 »
- ActivityGroup可以在子Activity当中点击按钮实现更新当前View吗?
- 可以android端向WebService端发送一个对象吗?八百里加急,求罩!!!!
- android中ListView怎样动态的加载图片呢?其中加载ListView上图片隔一段时间切换一次,求指教。
- apk下载到手机内存,安装时解析出错
- android游戏开发关于fash
- android上进行图像处理(如锐化,调整对比度)最好使用哪个类
- android 中音乐的播放怎么能做比较好
- webview可以在service中运行么?求大神解答
- android下如何截获蓝牙耳机的按键消息
- 请问下AndroidStudio中,有个类图标是一个c然后左右两条的含义
- 求解决 调用camera 画面变形的问题!3Q
- 有一个效果不知道如何实现
<uses-permission android:name="android.permission.RIDE_EXTERNAL_STORAGE" />是这两 个 没错把