1

I have a ListView in my Android app that shows items from a string-array in my strings.xml. The app I am making is a basic project management app, and I have two activities: the main ListView, and the task addition view that has a some buttons, EditTexts, date pickers, etc. I would like to add an item to the string-array each time that the user adds a task with the task name, and then when the user presses that entry, a Toast comes up with the due date. How would I go about doing this?

Thanks. (I would put my code here, but unfortunately the formatting is completely messed up when I copy and paste.)

Clarification: User goes to Task Addition page from main view. User types in Name, Date, Etc. Name appears in ListView of tasks.

Can I post a zip of all my code since I have 6 or 7 files?

2
  • What is your question, exactly? It's not very clear. Also, to post your code, paste it in, select it, and press Ctrl+K. Commented May 24, 2011 at 20:51
  • If you neeed to post 7 files worth of code, your question isn't specific enough. Narrow it down to a specific problem that you're having. Commented May 24, 2011 at 21:22

2 Answers 2

4

I don't think you can make edits to anything in your res folder at runtime, including the strings.xml. You are going to need to store your tasks in some other manner. You can use an SQLite database or Shared Preferences or write a file to internal or external storage. Which will work best depends on what exactly you are trying to accomplish. Perhaps if you could elaborate on what you are doing, or even post some of the code that you are currently using we could make a more specific suggestion.

Sign up to request clarification or add additional context in comments.

1 Comment

I decided to use an ArrayList in a java file and write to Internal Storage. Thanks!
0

The things in res/values are static and as such cannot be permanently changed, but if you'd like to get the actual array then add your own stuff temporary then follow this link as a resource on how to load it. Other then that your question is a bit unclear, can you elaborate?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.