Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void save(){
- String arquivo;//Log.i("VALOR", campos);
- String dados = "teste@teste.com" + "," + "123456";
- try {
- FileOutputStream fos = openFileOutput(arquivo, Context.MODE_PRIVATE);
- fos.write(dados.getBytes());
- fos.close();
- Log.i("VALOR", arquivo);
- } catch (Exception e) {
- E.printStackTrace();
- }
- }
- public void ler() {
- String email = "";
- String senha = "";
- String temp = "";
- try {
- FileInputStream fin = openFileInput(arquivo);
- int c;
- int ok = 0;
- while ((c = fin.read()) != -1) {
- if (!(Character.toString((char) c).equals(",")) && ok != 1) {
- email = email + Character.toString((char) c);
- } else if (ok == 0) {
- ok = 1;
- }
- if (!(Character.toString((char) c).equals(",")) && ok == 1) {
- senha = senha + Character.toString((char) c);
- }
- temp = temp + Character.toString((char) c);
- }
- Log.i("VALORES", "Valor Email: " + email);
- Log.i("VALORES", "Valor Senha: " + senha);
- Log.i("VALORES", "Valor Temp: " + temp);
- } catch (Exception e) {
- }
- }
Add Comment
Please, Sign In to add comment