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

  • Home
  • SEARCH
  • 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 8141255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:26:45+00:00 2026-06-06T12:26:45+00:00

New with Android. Sorry! I’m trying to create the following… Wait for Timer to

  • 0

New with Android. Sorry! I’m trying to create the following…

  1. Wait for Timer to Finish. (No issues here).
  2. Write time to a log file.
  3. Activate Timer again.
  4. Go back to step 1 & repeat.

The code for writing to the file is as follows…

    File file = new File("/sdcard/log.txt");
    BufferedWriter writer = new BufferedWriter(new FileWriter(file));
    writer.write(str);
    writer.newLine();
    writer.flush();
    writer.close();

The code is only writing the last .write in the file! The previous WRITE is removed. I suspect that its creating a new file everytime and writing the latest line. I tried with FOS and OSW but with same results! Please help, am stuck on this one for almost 48 hours.

  • 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-06T12:26:47+00:00Added an answer on June 6, 2026 at 12:26 pm

    Use the FileWriter in append mode.

    BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first,sorry for my bad English!! i'm new here and i'm a beginner of android
I'm new in Android development and I've a problem when I create my new
I'm relatively new to java and android development so sorry if this is a
I'm new to Android so sorry if the question is easy to answer. I
Hi I'm new to android programming, I'm trying to initiate the on click method
Am very new to Android programming, so sorry if this is a simple problem.
I'm new to Android development, so sorry if this question can be answered easily,
I'm new in Android (and in Java too), so sorry if my problem is
I'm trying to build this port of libSDL for Android, using the new Android
I am a new one in Android so please sorry for stupidity. Well my

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.