How to store and pull internally on android?
<p>I am having trouble trying to store a username string internally on an android devices.  My code is written to store the username and read it into a string and then display that string in a toast text box. I'm having errors creating the bold_username.txt file. Here is my code so far:</p>

<pre><code>package hello.tab.widget;



import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;

public class DisclaimerActivity extends Activity
{

public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.disclaimer);

final EditText et = (EditText)findViewById(R.id.et_username);
et.setOnClickListener(new View.OnClickListener() {



@Override
public void onClick(View v) {
et.setText("");

}
});

final Button button = (Button) findViewById(R.id.btn_accept);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final CheckBox checkBox = (CheckBox)findViewById(R.id.cb_disclaimer);

if (checkBox.isChecked()) {

String username = et.getText().toString();

String FILENAME = "bold_username.txt";
try {
FileOutputStream fos = new FileOutputStream(new File("bold_username.txt"));
fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(username.getBytes());
fos.close();
InputStream inputStream = new FileInputStream("bold_username.txt");
BufferedReader r = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line);
Toast.makeText(DisclaimerActivity.this, line,
Toast.LENGTH_SHORT).show();
}

}


catch (IOException e){
e.printStackTrace();
}

}
else {
Toast.makeText(DisclaimerActivity.this, "Please Check the
Checkbox", Toast.LENGTH_SHORT).show();
}
}
});
}


public void onCheckboxClicked(View v) {
}
}
</code></pre>
