[HP Top] |
MobileApp > Android > File Access 繝輔ぃ繧、繝ォ繧「繧ッ繧サ繧ケ縺ョ譁ケ豕 †繝輔ぃ繧、繝ォ繧「繧ッ繧サ繧ケ縺ョ讎りヲ †縲縲Android縺ァ縺ッjava.io繝代ャ繧ア繝シ繧ク縺ョ讓呎コ吠o縺御スソ逕ィ縺ァ縺阪k縲ゅョ縺ァ縲∫音縺ォ髮」縺励¥縺ェ縺 繝輔ぃ繧、繝ォ隱ュ霎シ †縲ス擾ス撰スス趣シヲス会ス鯉スシゥス趣ス撰ス包ス() 縺ァStream繧貞叙蠕励@縲〉ead()縺ァ隱ュ縺ソ霎シ繧 // 繝繧ュ繧ケ繝医ョ隱ュ霎シ 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(); } 繝輔ぃ繧、繝ォ譖ク霎シ †縲ス擾ス撰スス趣シヲス会ス鯉スシッス包ス費ス撰ス包ス() 縺ァ Stream繧貞叙蠕励@縲『rite()縺ァ譖ク縺崎セシ繧 // 繝繧ュ繧ケ繝医ョ菫晏ュ 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(); }
SD繧ォ繝シ繝 縺ク縺ョ繧「繧ッ繧サ繧ケ †
File file = Environment.getExternalStorageDirectory(); File file = File("/sdcard");
繝繧」繝ャ繧ッ繝医Μ讒区舌↓縺、縺縺ヲ †縲蟾・莠倶クュ 蜿り †縲Asset Manager縺ョ莉カ
|