Why are you using the final keyword?  I think that is the source of your
problem.  Remove that and I would be that everything will work out.

In java, "final" is more-or-less equivalent to "const" in c++.  Since you
are setting this variable every time a button is clicked I don't think you
want to set this to final.

I am curious though... what exactly is the error that you are getting?


----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Wed, Jan 27, 2010 at 9:26 AM, André <[email protected]> wrote:

> Hello,
>
> I'm sure there has been a lot of questions like this here already. But
> I haven't been able to find an answer to my question is. I'm still
> very new to this so it's probably something very simple.
> What I am trying is to save text from a edittext window, it works fine
> if I have a pre-written text. Any suggestion on how I should make this
> work?
>
> Bellow you can see what I have tried! The row with the stars is what
> eclipse doesn't accept.
>
>
> private EditText bodyText;
>
>    @Override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        setContentView(R.layout.main);
>
>
>
>        bodyText = (EditText) findViewById(R.id.body);
>        Button confirmButton = (Button) findViewById(R.id.confirm);
>        confirmButton.setOnClickListener(new View.OnClickListener() {
>
>                public void onClick(View view) {
>                        try {
>                            final String TESTSTRING = new String(bodyText);
>
> ********************************************************************************
>
>                            FileOutputStream fOut =
> openFileOutput("samplefile.txt",
> MODE_WORLD_READABLE);
>                            OutputStreamWriter osw = new
> OutputStreamWriter(fOut);
>
>
>                            osw.write(TESTSTRING);
>
>                            osw.flush();
>                            osw.close();
>
>                        } catch (IOException ioe) {
>                            ioe.printStackTrace();
>                        }
>                }
>
>            });
>        }
> }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to