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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:53:06+00:00 2026-05-30T10:53:06+00:00

The code creates a text file in local memory, but how do I get

  • 0

The code creates a text file in local memory, but how do I get all files created by my application in a list view:

public class newfile extends Activity {
    public EditText textBox,textbox2;
    FileOutputStream fos=null;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.newfile);
        Button save = (Button) findViewById(R.id.btnSave);
        save.setOnClickListener(new View.OnClickListener(){
            public void onClick(View v) {
                textBox = (EditText) findViewById(R.id.txtText1);
                textbox2 = (EditText) findViewById(R.id.fname);
                String FILENAME = textbox2.getText().toString();
                String value = textBox.getText().toString();
                try{
                    fos = openFileOutput(FILENAME,MODE_WORLD_WRITEABLE);
                }
                catch(IOException e)
                {
                    e.printStackTrace();
                }
                byte[] buffer = value.getBytes();
                try {
                    fos.write(buffer);
                    } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                try {
                    fos.flush();
                    } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                try {
                    fos.close();
                    Toast.makeText(getBaseContext(), "File saved successfully!", Toast.LENGTH_LONG).show();
                    finish();
                    } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        });
    }
}
  • 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-30T10:53:07+00:00Added an answer on May 30, 2026 at 10:53 am

    You can get a list all application files using Context.fileList. Then use ArrayAdapter to populate your list view

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

Sidebar

Related Questions

I created a small function that simply writes text to a file, but I
I created local resource files with VisualStudio (.resx and .fr.resx) for each page. All
I'm trying to create a program that takes a text file of c++ code
I need to create Perl code which allows counting paragraphs in text files. I
I created a grid of buttons. The following code creates the buttons and displays
In my .net mvc application, I need to dynamically insert contents from local files
I am working on a ASP.net project created with local file system settings. I
I have created a simple flash menu and the SWF file, JS files (swfoject.js
I've created a file /etc/profile.d/java.sh that includes (among other things) the line of code:
Client side javascript code creates some elements (about 50-100) in a cycle: for (var

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.