6
ฉันจะอ่านไฟล์ข้อความใน Android ได้อย่างไร
ฉันต้องการอ่านข้อความจากไฟล์ข้อความ ในโค้ดด้านล่างจะมีข้อยกเว้นเกิดขึ้น (ซึ่งหมายความว่าจะไปที่catchบล็อก) ฉันใส่ไฟล์ข้อความในโฟลเดอร์ของแอปพลิเคชัน ฉันควรวางไฟล์ข้อความนี้ไว้ที่ไหน (mani.txt) เพื่อให้อ่านได้อย่างถูกต้อง try { InputStream instream = openFileInput("E:\\test\\src\\com\\test\\mani.txt"); if (instream != null) { InputStreamReader inputreader = new InputStreamReader(instream); BufferedReader buffreader = new BufferedReader(inputreader); String line,line1 = ""; try { while ((line = buffreader.readLine()) != null) line1+=line; }catch (Exception e) { e.printStackTrace(); } } } catch …