• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get values from class object stored in arraylist  RSS feed

 
john bean
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i have a class making object from a wrapper class and am trying to retrieve values but cant i know im doing something really stupid any help would be great
first i create small arrays and a int that im using a a trigger for an action


here is the wrapper class creating the puzzle objects


I am then trying to retrieve the data lik handle.puzzles.get(0).//none of the values in the object appear ?

i have tryed inserting getters
and i have tryed creting a new puzzle object setting it equal to puzzles.get... but i am told by ide i cant set object to puzzles so what am i doing wrong i know this is a stupid question but my brain is wrecked
thanks
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please print out some of those Lists and see what they contain. There is something strange about your adding things at a particular index. Are you suffering any Exceptions when you do that adding? Is there anything else in those Lists? You need to know that you are looking at the correct index.
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
john bean wrote:I am then trying to retrieve the data lik handle.puzzles.get(0).//none of the values in the object appear ?

i have tryed inserting getters
and i have tryed creting a new puzzle object setting it equal to puzzles.get... but i am told by ide i cant set object to puzzles so what am i doing wrong i know this is a stupid question but my brain is wrecked
thanks

Can we see the code where you are trying to do this? Do you get a compile time or run time error/exception? Post entire error message here.

In one place you have "Handle.puzzles" and in your comment (above) you have "handle.puzzles", remember that Java is case sensitive.


'c' is a list of Integer types but your "c.add()" call is not adding an Integer.
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:
'c' is a list of Integer types but your "c.add()" call is not adding an Integer.

Hmmm, perhaps I spoke too soon. R.drawable.c1 could have been an Integer.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!