What variable is the ArrayList that you are trying to get data from? Using []s is for arrays.read a certain line of an ArrayList...
An ArrayList is a class which means you need to use its methods to get to its contents.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
What variable is the ArrayList that you are trying to get data from? Using []s is for arrays.read a certain line of an ArrayList...
An ArrayList is a class which means you need to use its methods to get to its contents.
If you don't understand my answer, don't ignore it, ask a question.
I'm converting ints to strings to add to an array list and then trying to read the line of the arraylist to convert it back to an int. What method should I use to get the int/string?
Current Projects (and planned release dates):
Chomp's Wacky Worlds [???] (PC, Android and Ouya)
Kyle the Caiman [???] (PC, Android and Ouya)
KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)
For int to String see the String class's value of method or the Integer class's toString method.
If you don't understand my answer, don't ignore it, ask a question.
I'm already using toString, the problem is reading the string from the ArrayList. I'm thinking the toArray() method might be the answer, but it seems like it wastes resources.
Current Projects (and planned release dates):
Chomp's Wacky Worlds [???] (PC, Android and Ouya)
Kyle the Caiman [???] (PC, Android and Ouya)
KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)
Please post the code you are having trouble with and describe what the problem is.the problem is reading the string from the ArrayList.
If you don't understand my answer, don't ignore it, ask a question.
Nevermind, I saw a method in the suggested endings list in Eclipse called ".get(index)". Apparantly Arraylist.get(index) was exactly what I needed! Thanks for all the help you guys!
Current Projects (and planned release dates):
Chomp's Wacky Worlds [???] (PC, Android and Ouya)
Kyle the Caiman [???] (PC, Android and Ouya)
KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)
Reading the API doc for the classes you are using can make writing code easier.
See post #26.
If you don't understand my answer, don't ignore it, ask a question.