Jump to content
Purex Armstong

Android Studio

Recommended Posts

Purex Armstong

Boas Tardes estou com uma duvida na minha aplicação, 

public void btn(View view) {
 String text = edtEmail.getText().toString();
 String text1 = edtNome.getText().toString();
 String text2 = edtTelemovel.getText().toString();
 String text3 = edtData.getText().toString();
 FileOutputStream fos = null;
 try {
  fos = openFileOutput(FILE_NAME, MODE_PRIVATE);
  fos.write(text1.getBytes());
  fos.write(text.getBytes());
  fos.write(text2.getBytes());
  fos.write(text3.getBytes());
  edtEmail.getText().clear();
  edtNome.getText().clear();
  edtTelemovel.getText().clear();
  edtData.getText().clear();
  Toast.makeText(this, "Guardado", Toast.LENGTH_LONG).show();
 } catch (FileNotFoundException e) {
  e.printStackTrace();
 } catch (IOException e) {
  e.printStackTrace();
 } finally {
  if (fos != null) {
   try {
    fos.close();
   } catch (IOException e) {
    e.printStackTrace();
   }
  }
 }
}

Onde é que eu deverei por codigo para me fazer espaços ao guardar no ficheiro?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.