display all textfiles in listview created by your app
<p>The code creates a text file in local memory, but how do I get all files created by my application in a list view:</p>

<pre><code>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();
                }
            }
        });
    }
}
</code></pre>
