开发者

Android: How to update specific line of text file

does anyone has idea on how to code this:

I have a text f开发者_开发百科ile with contents (4 lines):

1 I am Kris
2 I live in CA
3 With my wife
4 And son

Then I want to update the second line I live in CA to I live in New York

Is it possible?


The easiest way just to read whole file, modify lines and write back.

You can try RandomAccessFile class, but I think it will be overhead. You'll need to do more work and it will be harder to implement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜