android: file saving system
<p>I wrote a simple file saving system. But it doesn't work. I wrote it before and it works. Probably I forgot something. Could someone tell me what I forgot?
Thanks!
XML</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    &gt;
&lt;TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    android:id="@+id/hello"
    /&gt;
&lt;Button android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:id="@+id/btn"
        android:text="save"
        android:layout_gravity="center_vertical|center_horizontal"/&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Activity:</p>

<pre><code>package com.android.savefiletest;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class SaveFileTestActivity extends Activity {
    /** Called when the activity is first created. */
    FileService file;
    TextView hello;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button btn = (Button)findViewById(R.id.btn);
        hello = (TextView)findViewById(R.id.hello);
        btn.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                try {
                    file.save("1.txt", hello.getText().toString());
                    Toast.makeText(SaveFileTestActivity.this, "success", 1).show();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    Toast.makeText(SaveFileTestActivity.this, "error", 1).show();
                }
            }
        });
    }
}
</code></pre>

<p>FileService.java</p>

<pre><code>package com.android.savefiletest;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import android.content.Context;

public class FileService{
    private Context context;

    public FileService(Context context) {
        this.context = context;

    }

    public void save(String filename, String content) throws Exception{
        FileOutputStream outStream = context.openFileOutput(filename, Context.MODE_PRIVATE);
        outStream.write(content.getBytes());
        outStream.close();
    }
}
</code></pre>
