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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:07:05+00:00 2026-06-15T17:07:05+00:00

Hii I am New to Android Development an i am trying this simple application

  • 0

Hii I am New to Android Development an i am trying this simple application and my issues is
I am Trying to save a block of data from Edit Text to a file on click of a Button
but I am unable to do so!
my Block of Code is

 saveBtn.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        String str = textBox.getText().toString();

        try
        {

            FileOutputStream fOut =
            openFileOutput("textfile.txt", MODE_WORLD_READABLE); 
            OutputStreamWriter osw = new OutputStreamWriter(fOut);


            osw.write();
            osw.flush();
            osw.close();


            Toast.makeText(getBaseContext(), "File saved successfully!", Toast.LENGTH_SHORT).show();


            Toast.makeText(getBaseContext(), "file path" + getFileStreamPath ("textfile.txt"), Toast.LENGTH_LONG).show(); 
            textBox.setText("");
        }

        catch (IOException ioe) 
        {
            ioe.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-06-15T17:07:07+00:00Added an answer on June 15, 2026 at 5:07 pm

    You were unable to do so because you not passing the Str value
    ie String str = textBox.getText().toString();

    to:- osw.write();
    Like I have Done

    osw.write(str);

    this will solve your problem I have Tested this

    for more such resources, just have a look at the below site

    http://www.suvenconsultants.com/

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

Sidebar

Related Questions

Hi I am new into android development and I am having trouble into this
Hi I'm new to Android Programming and I'm trying to make a simple program
Hi I'm developing with new android 4.0 SDK on Eclipse. Somehow this simple if
Hi I am trying to send mail from my android application but I am
Hi I am new to android development. I am trying to make my android
Hi I am new in android development, my question is how to obtain data
Hi I'm trying to integrate MySpace with my Android app. As I'm new to
Hi I'm new to android programming, I'm trying to initiate the on click method
Hi i'm relatively new to android programming and am trying to do the following.
Hi I am new to android development and I'm working on a game. Right

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.