Search code examples
javaandroidfirebasefirebase-realtime-databaseint

Can I store Int value inside Firebase database


I have store resource values in variables, and now I want to store this variable inside the Firebase database but the data type is Integer (int) and I don't know can we store an integer in Firebase or not.

I want to store below two variables of Integer type inside Firebase Database:

int textColor = ResourcesCompat.getColor(getResources(),R.color.black, null);
int textSize = (int) (getResources().getDimension(R.dimen.text10sp));

Solution

  • Can I store Int value inside Firebase database?

    Sure you can, in a property of type Long, which is a supported data-type. An int value will always fit in a Long.