Answer the question
In order to leave comments, you need to log in
Where can I store the values at the time of the robots of the application and work with them?
At startup, a command is executed that receives an array, something like this:
{1, 3, 22, 88, 64, 40, 2, 12, 55, 69}
I need to bring them into memory, and then compare them with those that will come further
, if the same array came, then everything is OK, but if it came with other data, an action is needed.
So, where can I store this data so that when I finish working with the application, they are destroyed.
Need temporary storage of data (arrays of int)
Or just get data from an array and write them to variables and then compare ???
Answer the question
In order to leave comments, you need to log in
all the guys from Mozilla to Skype use SQLite
developer.android.com/reference/android/database/s...
Everything strongly depends on the application, it is possible in the application itself in a singleton, you can write to the database, you can use memcached, redis .... In general, the simplest is the singleton + syncronize ...
You can store it in the fragment / activity in which this comparison occurs so as not to overload the application with all sorts of configs and databases for such a simple task. It is only important to ensure that this data does not disappear anywhere if, for some reason, the fragment / activity is recreated
It is best to agree with the backend developer to use the ETag mechanism ( https://ru.m.wikipedia.org/wiki/HTTP_ETag ) and not suffer from storage / comparison issues. If there were no changes on the backend, just return an empty response with a 304 code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question