package com.example.filedemo;
import java.io.InputStream;
import java.util.Scanner;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
private TextView txt=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txt=(TextView)findViewById(R.id.txt);
InputStream input=getResources().openRawResource(R.raw.test);
Scanner scan=new Scanner(input);
while(scan.hasNext()){
txt.append(scan.next()+"\n");
}
}
}
存储方式二:文件(raw下的文本文件)
最新推荐文章于 2023-04-19 10:36:56 发布