Android上如何对文件进行读写
如题,我试了一下用FileInputStream,但是总是显示读不出来,(文件是存在的)。不知道是不是我用的不对,请知道的大哥指点一下。
FileInputStream fIn = null;
InputStreamReader isr = null;
char[] inputBuffer = new char[255];
String data = null;
try
{
fIn = openFileInput("/data/data/com.android.phone/shared_prefs/_has_set_default_values.xml");
isr = new InputStreamReader(fIn);
isr.read(inputBuffer);
data = new String(inputBuffer);
text_data.setText(data);
}catch(Exception e)
{
e.printStackTrace();
text_data.setText("can not find this file\n");
WarrningDialog();
}finally
{
}