Guest User

Untitled

a guest
Aug 20th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. public void SaveText(View view)
  2. {
  3. File CS_File = new File(this.getExternalFilesDir(null), "BLUH.txt");
  4. CS_File.mkdirs();
  5. try {
  6. CS_File.createNewFile();
  7. FileWriter CS_FileWriter = new FileWriter(CS_File);
  8. EditText CS_EditText = (EditText)findViewById(R.id.createscreen_edittext);
  9. String CS_MessageTemp = CS_EditText.getText().toString();
  10. CS_FileWriter.write(CS_MessageTemp);
  11. CS_FileWriter.close();
  12. }
  13. catch (IOException e) {
  14. Log.w("WriteFile", "Error writing" + CS_File, e);
  15. }
  16. TextView CS_TestText = (TextView)findViewById(R.id.createscreen_testtext);
  17. CS_TestText.setText(CS_File.toString());
  18. }
  19. public void LoadText(View view)
  20. {
  21. File CS_File = new File(this.getExternalFilesDir(null), "BLUH.txt");
  22. String CS_Message = "";
  23. try {
  24. FileInputStream CS_FileInputS = new FileInputStream(CS_File);
  25. CS_FileInputS.read(CS_Message.getBytes(), 0, CS_Message.length());
  26. CS_FileInputS.close();
  27. } catch (IOException e) {
  28. Log.w("LoadFile", "Error loading" + CS_File, e);
  29. }
  30. Intent INT_DisplayScreen = new Intent(this, ACT_DisplayScreen.class);
  31. INT_DisplayScreen.putExtra(EXTRA_MESSAGE, CS_Message);
  32. startActivity(INT_DisplayScreen);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment