Issue
I'm not really sure if this is completely save. I read some data from different online sources and save those data in a local database. I need to save a resource id from my apps resources as well, to display the data from the online source correctly localised.
Is it save to save the resource id in my database? I'm not sure if cleaning a project or a new build will make sure that the ids don't change...
Is there an alternate solution? Saving the resource name is an alternative, as long as I don't change the resource's name... Probably that's the better approach?
Solution
Working with resource IDs is not safe. Whenever you add or delete a resource, all of the other IDs may change.
As you mentioned, naming convention is a better approach. You can get ID of a resource which given name but you should not expect much performance.
On the other hand, i would try to use another way. For example; I have a resource and an online data which pairs with it. One of datas are in online sources and other is locally hold. Why not store both of them in online sources?
Hope it helps you.
Answered By - Emre Aktürk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.