解决方案 »
- 有没有用mosquitto做推送的?有一个问题问一下
- Android系统自动同步时间的问题
- OAuth2 微薄认证 API出现的问题 怎么办
- 编译emulator -system system.img -data userdata.img -ramdisk ramdisk.img 后出现问题
- 电信定制android手机来电号码无法获取问题
- TelephonyManager.getCellLocation()求释疑
- 大家帮忙想下手机方面的idea和专利吧
- 如何做一个类似于课程格子的那种弧形半圆菜单?
- Android 4.4.3下webview无法加载adobe flash player 插件
- draw9path.bat运行一闪而过
- J2EE 还是Android?
- android应用 服务器端
public void save(String filename, String filecontent) throws Exception {
// 在这里直接使用了一个没赋值的context所以出空指针
FileOutputStream outStream = context.openFileOutput(filename, Context.MODE_PRIVATE);
outStream.write(filecontent.getBytes());
outStream.close();
}修改: Context context;
public void save(Context context,String filename, String filecontent) throws Exception {
this.context=context;
FileOutputStream outStream =context.openFileOutput(filename, Context.MODE_PRIVATE);
outStream.write(filecontent.getBytes());
outStream.close();
}