Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8294865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:22:42+00:00 2026-06-08T14:22:42+00:00

i am writing a string to a file in android using : BufferedWriter writer

  • 0

i am writing a string to a file in android using :

BufferedWriter writer = new BufferedWriter(new FileWriter(order));
        writer.append(placedOrder);

whether i use

writer.write(placedOrder); // or
writer.append(placedOrder);

the data of the file is erased every time i run this code.
I want to add the data to the end of file.

Ex: When i run first time :

file output
My

Ex: When i run second time :

file output becomes
My
Name

Ex: When i run third time :

file output
My
Name
is

Ex: When i run fourth time :

file output
My
Name
is
Hisham.

and so on. Like having a record of all previous outputs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:22:43+00:00Added an answer on June 8, 2026 at 2:22 pm

    Your current code uses FileWriter with default append mode set to false. You need to use the constructor in which you can set append to true:

    public FileWriter (File file, boolean append) Since: API Level 1

    Creates a FileWriter using the File file. The parameter append
    determines whether or not the file is opened and appended to or just
    opened and overwritten.

    Parameters
    file : the non-null File to write bytes to.
    append : indicates whether or not to append to an existing file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a file on a network drive into a new folder. string directory=@\\dir\test\
I am writing to file in android and read from the same file using
Perl is really good for writing the kind of string/file parsing programs that I
I am writing an android app for which I want to write a function
I'm using following code to extract a string variable in my JavaScript file in
I am writing an Android app where I need to pass a string array
I'm using Android to read a document off the net, surprise I'm writing here
I am read & write username & password to android device using my application
I am writing a program that gets a HTML file in Android and I
I am parsing an XML file for an Android app I am writing and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.