FileOutputStream fileOutputStream = null;ObjectOutputStream objectOutputStream = null;try{   JSONObject jsonObject=new JSONObject(msg);   String status=jsonObject.getString("status");   if(status.equals("1")){      Gson gson=new Gson();      teacherResponseList=gson.fromJson(jsonObject.getJSONArray("result").toString(),new TypeToken<List<TeacherResponse>>(){}.getType());      Log.d("queryteacherandgroup",msg);      Log.d("query", "查询理财师列表ONACTIVITYCreatedOEHttpCallBack");      File teacherFile = new File(Environment.getExternalStorageDirectory().toString() + File.separator + "teacher.dat");      if (!teacherFile.getParentFile().exists()) {         teacherFile.getParentFile().mkdirs();      }      if (!teacherFile.exists()) {         teacherFile.createNewFile();      }      fileOutputStream = new FileOutputStream(teacherFile.toString());      objectOutputStream = new ObjectOutputStream(fileOutputStream);      objectOutputStream.writeObject(teacherResponseList);   }}catch (Exception e){   e.getStackTrace();}finally {   if (fileOutputStream != null) {      try {         fileOutputStream.close();      } catch (Exception e) {         e.getStackTrace();      }      if (objectOutputStream != null) {         try {            objectOutputStream.close();         } catch (Exception e) {            e.getStackTrace();         }      }   }   //mGroupAdapter.notifyDataSetChanged();   

}

 FileInputStream fileInputStream = null;    ObjectInputStream objectInputStream = null;    try{        File teacherFile = new File(Environment.getExternalStorageDirectory().toString() + File.separator + "teacher.dat");        if (!teacherFile.getParentFile().exists()) {            teacherFile.getParentFile().mkdirs();        }        if (!teacherFile.exists()) {            teacherFile.createNewFile();        }        fileInputStream = new FileInputStream(teacherFile.toString());        objectInputStream = new ObjectInputStream(fileInputStream);        teacherResponseList=(List<TeacherResponse> )objectInputStream.readObject();    }catch (Exception e){        e.getStackTrace();    }finally {        if (fileInputStream != null) {            try {                fileInputStream.close();            } catch (Exception e) {                e.getStackTrace();            }            if (objectInputStream != null) {                try {                    objectInputStream.close();                } catch (Exception e) {                    e.getStackTrace();                }            }        }    }}

更多相关文章

  1. Dialog-普通对话框-列表对话框
  2. android 权限列表
  3. 【ListView】列表Item样式
  4. android 开发 RecyclerView 横排列列表布局
  5. android 浏览普通彩信列表核心源码
  6. Android开发_Android如何获取开机启动项列表_查找package是否有
  7. Android实现获取系统应用列表
  8. 每个Android开发者都应该了解的资源列表

随机推荐

  1. php中如何进行小写转换?
  2. PHP以正则表达式验证手机号码
  3. 如何实现php中date只显示年月日
  4. 如何解决php中fpm无法启动
  5. 如何解决php连接erp数据库失败
  6. 如何解决在php用gd库输出图片到微信浏览
  7. 详解PHP中php switch的方法实例
  8. 代码分析php中的回调函数
  9. PHP使用 is_numeric的实例解析
  10. PHP 使用 Trait 解决 PHP 单继承问题的实