Text Files and Android Application Q
I am new to Android programming, and I am trying to make an application that will read files from a bluetooth device. I don't need to worry about that right now, since that is the last step I plan to do.
I wa开发者_开发百科nt to create my own textfile so that I could read fake data from that file and use it to test if my code and function of the application actually work. How would I go about creating this file in Android? And also, how would I also read the text file into my code?
Having a search on google would have found it pretty easy...
Reading a file from sd card: How can I read a text file from the SD card in Android?
Creating: Android write to sd card folder
By the help of string builder you can create a content to write in your file. After that create a stream writer to write file in memory. Remember to add permission in your AndroidManifest.xml file. I mentioned three steps here. Step by step follow these steps and you will be able to create text file. Now again to read this file you have to create a stream reader.
Just google the code for string builder, stream reader, stream writer in java.
If you still have any question or i am missing something, then reply.
精彩评论