Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private final String weatherInfoFileName = "weatherInfo";
- private void serializeChannel()
- {
- try
- {
- FileOutputStream fos = weatherAppActivity.openFileOutput(weatherInfoFileName, Context.MODE_PRIVATE);
- ObjectOutputStream os = new ObjectOutputStream(fos);
- os.writeObject(channel);
- os.close();
- fos.close();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- private void deserializeChannel()
- {
- try
- {
- FileInputStream fis = weatherAppActivity.openFileInput(weatherInfoFileName);
- ObjectInputStream is = new ObjectInputStream(fis);
- channel = (Channel) is.readObject();
- is.close();
- fis.close();
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- public boolean isWeatherInfoInFile()
- {
- File file = new File(weatherInfoFileName);
- return file.exists();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement