Androidではjava.ioパッケージの標準ioが使用できる。ので、特に難しいことはない
open File Input() でStreamを取得し、read()で読み込む
// テキストの読込
public void loadText() throws IOException{
String path = "data.txt";
FileInputStream input = this.openFileInput(path);
byte[] buffer = new byte[1000];
input.read(buffer);
String s = new String(buffer).trim();
edit.setText(s);
input.close();
}
open File Output() で Streamを取得し、write()で書き込む
// テキストの保存
public void saveText(String data) throws IOException{
String path = "data.txt";
FileOutputStream output = this.openFileOutput(path, Context.MODE_WORLD_READABLE);
output.write(data.getBytes());
output.close();
}
AndroidでSDカードにアクセスするサンプル
File file = Environment.getExternalStorageDirectory();
File file = File("/sdcard");
Asset Managerの件
http://blog.haw.co.jp/android/?p=42
http://android.g.hatena.ne.jp/n4_t/20090622/1245689916
http://groups.google.co.jp/group/android-group-japan/browse_thread/thread/567326c74ebade70
超わかりやすいHPを発見
http://libro99.appspot.com/index3?id=36