Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. public void zapisz(View view){
  2. String dane= String.valueOf(((EditText)findViewById(R.id.editText)).getText());
  3.  
  4. try {
  5. FileOutputStream fOut = openFileOutput("file",MODE_WORLD_READABLE);
  6. fOut.write(dane.getBytes());
  7. fOut.close();
  8. Toast.makeText(getApplicationContext(),"UDALO SIE",Toast.LENGTH_SHORT).show();
  9. } catch (FileNotFoundException e) {
  10. e.printStackTrace();
  11. } catch (IOException e) {
  12. e.printStackTrace();
  13. }
  14.  
  15. }
  16. public void wczytaj(View view){
  17. try{
  18. FileInputStream fin = openFileInput("file");
  19. int c;
  20. String temp="";
  21. while( (c = fin.read()) != -1){
  22. temp = temp + Character.toString((char)c);
  23. }
  24. fin.close();
  25. ((TextView)findViewById(R.id.loaded)).setText(temp);
  26. Toast.makeText(getApplicationContext(),"UDALO SIE",Toast.LENGTH_SHORT).show();
  27. }catch(Exception e) {}
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement