praveen

Reading the file

Oct 19th, 2011
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public void fileReading() throws IOException
  2. {
  3. File f = new File("/data/data/com.android/files/contacts");
  4.  
  5. if(!f.exists())
  6. {
  7. Toast.makeText(context, "File not found", Toast.LENGTH_SHORT).show();
  8. }else
  9. {
  10. FileReader fr = new FileReader(f);
  11. BufferedReader reader = new BufferedReader(fr);
  12. String st = name;
  13. while((st = reader.readLine()) != null)
  14. {
  15. Toast.makeText(context, st, Toast.LENGTH_SHORT).show();
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment