Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring 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
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Need to calculate the Sum of Values from RecyclerView, and pass to MainActivity

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a RecylerView, called from my MainActivity.
This RecyclerView holds a list of Titles and Values.
(Detail: They are Attributes of your character in a Game. e.g. Strength 50, Agility 62, Wisdom 43 etc)
The user can change the Values (I am currently using a Spinner, but am open to other methods)

I need to display a total of these Values, and also update the Person Object with them.

From what I can see, I need to set a Listener to notice a Change, and then use an Interface to call a Method in Main Activity, but I cannot find details on this.
Searching fro "interface" produces results about UI.

How do I go about this?
 
Rancher
Posts: 535
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to look up interface on the java documents.   Basically you have a class 'implements' the interface and then implement it.
 
Phil Webster
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I had more of a search on "Interface" and eventually found some pages that explained it in a simple manner.

 
reply
    Bookmark Topic Watch Topic
  • New Topic