Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 39
Registered: ‎03-09-2014
My Device: Simulator
My Carrier: NA
Accepted Solution

User Input to JSON, and Mathematical Operation

Hello guys,


Now, i'm currently building another app, and i want to use JSON as my database. There will be multiple inputs (user inputs, INTEGER) from textfield which will be saved in JSON, then i want to apply mathematical addition to each input which is saved in JSON database (total value), then display it in the user interface. I also want to try this with XML, but i don't know if i could do this with XML.


The sample app given in the documentation (saving data with JSON) is not applied with user inputs, but we specify the data. Also there's no example of mathematical operation in database. I still don't know the concept, and how to write the code.


Any help would be appreciated. Thank you.

Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: User Input to JSON, and Mathematical Operation

Mathematical operations can be performed in the app itself.

1) Create input controls, a button which will trigger the operation. On click, calculate the result, update the result field, then save the inputs and the result to DB, JSON or XML file.

2) When the page is loaded in onCreationCompleted handler on Page read the saved values (if any) and fill the controls with the data.

If you need help, please post the code you have so far and someone may be be able to help with specific problems.

Andrey Fidrya, @zmeyc on twitter