0

I am trying to develop application for android . how I can get the defining line of textfile ? For instance I have to read 15. line of textfile. how I can do that?

ali
  • 1
  • 1
    Other than the 'android' tag this is a duplicate of http://stackoverflow.com/questions/2312756/in-java-how-to-read-from-a-file-a-specific-line-given-the-line-number – Skip Head Oct 02 '10 at 14:32
  • Agreed. And the other question is more intelligible. – Stephen C Oct 02 '10 at 14:51

1 Answers1

0

Unless you know each line has the same length, the only way is to read each line until you get to the 15th. You can't skip to a specific line unless you have a way to calculate its offset, or maintain some sort of index file.

Brad Mace
  • 27,194
  • 17
  • 102
  • 148