Created
February 9, 2018 08:11
-
-
Save tuttelikz/d3de39f8fa14fb0d5aba6aa29ffabdc1 to your computer and use it in GitHub Desktop.
This is a function to load text from storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void load(View view) { | |
try { | |
FileInputStream fileInputStream = openFileInput("vivz.txt"); | |
int read = -1; | |
StringBuffer buffer = new StringBuffer(); | |
while((read=fileInputStream.read())!=-1) { | |
buffer.append((char) read); | |
} | |
Log.d("VIVZ",buffer.toString()); | |
String text1 = buffer.substring(0,buffer.indexOf(" ")); | |
String text2 = buffer.substring(buffer.indexOf(" "+1)); | |
username.setText(text1); | |
password.setText(text2); | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
Toast.makeText(this,"Load successful",Toast.LENGTH_SHORT).show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment