Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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

 
Phil Webster
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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?
 
Al Hobbs
Rancher
Posts: 506
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • 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
  • 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.

 
What does a metric clock look like? I bet it is nothing like this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!