tags:

views:

25

answers:

1

Hello In my android app i am reading a file but require anly the data on third line to be displayed.Is there any way to do that.

Please forward your suggestion:)

Thanks in advance.

A: 

Not to be too specious, but.....

String str = InputStream.readline();
str = InputStream.readline();
str = InputStream.readline();

Now you have your string ;)

Just be happy that you don't need the thousandth string. (of course, enclosing this is a parameterized for loop would solve that problem)

KevinDTimm
Thanks Kevin.Its working but is there any way that i can even set or replace the same line with some other data.
Remmyabhavan
That requires reading the entire file and when you get to the desired line, write the new value, not the old value.
KevinDTimm