I'm sure there are multiple approaches to this problem, but this is what I would do (from a purely Java approach):
Solution
1. Create a class called Category (or name it what ever you like, but Category seems appropriate)
2. Have Category extend ArrayList (so now Category is an ArrayList but your about to make it much more than just an ArrayList)
3. In the constructor of Category, you will have a String parameter called name and a String field called name, you will store the argument into the field once the object is created
4. You will have a method called getName (which returns the field called name)
5. In your main class (the class in which you handle and listen for actions in), you will create an ArrayList of the class Category called categories
6. Each time the user creates a new category you will add that category to the ArrayList categories with the user specified name of the category
7. Done.
So something like this:
PHP:
//YOUR MAIN CLASS - your class that handles and listens for actions
class Main{
ArrayList<Category> categories = new ArrayList<Category>();
//...
//when user enters category information
categories.add(new Category(tv.getText()+"");
//...
}
//CATEGORY CLASS - a class that store each category
class Category extends ArrayList{
private String name;
Category(String name){
this.name = name;
}
String getName(){
return name;
}
}
Wata