开发者

Creating, Editing, and Retrieving a List

I have a class that开发者_运维技巧 collects a series of strings (contact's names) and I need a way to save them all to a List. I have searched everywhere but everything I find has to do with ListViews. I need a method that will allow me to add, edit, and delete my strings from an .xml file. I have tried to use located in resources/values but it does not seem that you can edit the file within a class. The reason I need this is so that the user can load specific lists on command by their name, so using a simple String array will not suffice. When the user selects a specific list file, the string values within it would be placed in a string array and displayed in a ListView. What methods would I use to achieve this (besides SQlite)?

I appreciate any and all advice

-Nate


What methods would I use to achieve this (besides SQlite)?

An XML file. Or a JSON file. Or a CSV file. Or a plain text file with one string per line. Or any number of other file-based storage strategies. Use standard Java file I/O coupled with whatever parsing/encoding (XML, JSON, CSV, etc.) approach you want. Store the file in the directory retrieved from getFilesDir() in your activity.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜