if( Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED) )
{
File dir = Environment.getExternalStorageDirectory();
try {
File file = new File(dir, "jiaoz.txt");
FileOutputStream fos
= new FileOutputStream(file);
fos.write( "鬼吹灯这部小说来源于真实的咧比故事。。".getBytes() );
fos.flush();
fos.close();
fos = null;
} catch (IOException e) {
e.printStackTrace();
}
}
} else if (view.getId() == R.id.button2) {
String a = "";
if( Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED) )
{
File dir = Environment.getExternalStorageDirectory();
try {
File file = new File(dir, "jiaoz1.txt");
FileInputStream fis
= new FileInputStream(file);
int count = fis.available();
byte[] bytes = new byte[count];
int len=0;
while((len=fis.read(bytes))!=-1){
System.out.println(len);
a=a+new String(bytes,0,len);
}
aa.setText(a);
fis.close();
fis = null;
} catch (IOException e) {
e.printStackTrace();
}
} }
else if (view.getId() == R.id.button3) {
String a = "";
if( Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED) )
{
File dir = Environment.getExternalStorageDirectory();
try {
File file = new File(dir, "jiaoz2.txt");
FileInputStream fis
= new FileInputStream(file);
int count = fis.available();
byte[] bytes = new byte[count];
int len=0;
while((len=fis.read(bytes))!=-1){
System.out.println(len);
a=a+new String(bytes,0,len);
}
aa.setText(a);
fis.close();
fis = null;
} catch (IOException e) {
e.printStackTrace();
}
} }
![](https://i-blog.csdnimg.cn/blog_migrate/3bbec5cdbea6abe2c68531ccc0ceebe1.gif)
if( Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED) )
{
File dir = Environment.getExternalStorageDirectory();
try {
File file = new File(dir, "jiaoz.txt");
FileOutputStream fos
= new FileOutputStream(file);
fos.write( "鬼吹灯这部小说来源于真实的咧比故事。。".getBytes() );
fos.flush();
fos.close();
fos = null;
} catch (IOException e) {
e.printStackTrace();
}
}
} else if (view.getId() == R.id.button2) {
String a = "";
if( Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED) )
{
File dir = Environment.getExternalStorageDirectory();
try {
File file = new File(dir, "jiaoz1.txt");
FileInputStream fis
= new FileInputStream(file);
int count = fis.available();
byte[] bytes = new byte[count];
int len=0;
while((len=fis.read(bytes))!=-1){
System.out.println(len);
a=a+new String(bytes,0,len);
}
aa.setText(a);
fis.close();
fis = null;
} catch (IOException e) {
e.printStackTrace();
}
} }
else if (view.getId() == R.id.button3) {
String a = "";
if( Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED) )
{
File dir = Environment.getExternalStorageDirectory();
try {
File file = new File(dir, "jiaoz2.txt");
FileInputStream fis
= new FileInputStream(file);
int count = fis.available();
byte[] bytes = new byte[count];
int len=0;
while((len=fis.read(bytes))!=-1){
System.out.println(len);
a=a+new String(bytes,0,len);
}
aa.setText(a);
fis.close();
fis = null;
} catch (IOException e) {
e.printStackTrace();
}
} }
![](https://i-blog.csdnimg.cn/blog_migrate/3bbec5cdbea6abe2c68531ccc0ceebe1.gif)