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 6076345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:35:49+00:00 2026-05-23T10:35:49+00:00

I am working on an ANDROID project where i have to create a CSV

  • 0

I am working on an ANDROID project where i have to create a CSV file from some data.
I am able to create csv file and store data by creating Captions.

Code Snippet for that is given Below::

package com.csvtry;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;

public class csvtry extends Activity {
    public static String abc=null;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        generateCsvFile("Example1.csv"); 

    }
    private static void generateCsvFile(String sFileName)
    {
        try
        {
            File root = Environment.getExternalStorageDirectory();
            File gpxfile = new File(root, sFileName);
            FileWriter writer = new FileWriter(gpxfile);

            abc="Guwahati";

            writer.append("Emp_Name");
            writer.append(',');
            writer.append("Adress");
            writer.append('\n');

            writer.append("hussain");
            writer.append(',');
            writer.append("Delhi");
            writer.append('\n');

            //generate whatever data you want

            writer.flush();
            writer.close();
        }
        catch(IOException e)
        {
            e.printStackTrace();
        } 
     }
}

As in above code, we can see, Example1.csv is created and stored in SDCARD.
I works absolutely fine….

But i want to write some new data in new rows and columns in Example1.csv.

But when i try to run emulator again with some new data, it replaces existing row data.

My question is that, how can we write new data in new row without replacing previous data?
How to write new data in new rows ???

I am stuck on this…Please give me suggestions how to proceed ..

Thanks in advance….

  • 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-05-23T10:35:49+00:00Added an answer on May 23, 2026 at 10:35 am

    You can try using

    FileWriter(String filename, boolean append)
    

    to append data to the end of the file

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

Sidebar

Related Questions

I'm working on android unity3d project where I want to post some stuff to
Im an Android noob, coming from objC, I have a very stupid question (project
I am working on android applications. In my project I need to create Listview.
I am working on an Android project and have a problem with SQLite database
I am working on a project in android.In this project i have to move
I am currently working on an android project. I am trying to have an
I'm working with some Android code created by other developers, and they've asked me
I'm on Mac, working on Android development from the terminal. I have successfully created
I am working on a existing android project for my client. I have made
I am working with the sample Home application project on http://developer.android.com/resources/samples/Home/index.html I've added another

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.