Skip to content
Advertisement

Failed to convert a value of type java.lang.String to int?

I am trying to display the total expenses in a Text view but the application keeps giving me this error. The application uses Firebase and I had the getAmount() and setAmount() initiated as String since I only needed to display. It works as Strings but the amount doesn’t get added to himself it just goes in front of the first amount, like a string. Anyone know what can I do to have my to application reed integer.

I’m using the getAmount() type and it is initiated as an integer.

Error is in the personal fragment inside the addValueEvent Listener HELP!

Personal fragment where the addValueEventListener should display me the total amount.

JavaScript

Personal Expense data

JavaScript

This the error

JavaScript

Here is the database from Firebase

This is how I am storing the data in the database

JavaScript

Advertisement

Answer

I guess your database is sending getAmount in String format. Use

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement