Guest User

Untitled

a guest
Jan 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. save.setOnClickListener(new View.OnClickListener() {
  2. @Override
  3. public void onClick(View v) {
  4. FILENAME = filename.getText().toString();
  5. COMMENTS = comments.getText().toString();
  6. try {
  7. FileOutputStream f = openFileOutput(FILENAME,
  8. Context.MODE_PRIVATE);
  9. f.write(COMMENTS.getBytes());
  10. f.close();
  11. Toast.makeText(getBaseContext(),
  12. "Saved",
  13. Toast.LENGTH_SHORT).show();
  14. } catch (FileNotFoundException e) {
  15. // TODO Auto-generated catch block
  16. e.printStackTrace();
  17. } catch (IOException e) {
  18. // TODO Auto-generated catch block
  19. e.printStackTrace();
  20. }
  21.  
  22. }
  23.  
  24. });
Add Comment
Please, Sign In to add comment