Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

how to get values from class object stored in arraylist

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 73733
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 8446
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8446
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic