Static methods in activities

@Everyone

I have a question regarding the generated code from the console for crud operations. I noticed that the activities have static methods for retrieving the results loaded from find operations like so

public static BackendlessCollection getResultCollection()
{
return resultCollection;
}

public static Object getResultObject()
{
return resultObject;
}

Is this something that is recommended, or something that the sample code is using for demonstrations purposes and ease of access? I am asking this, because I was thinking of doing the same before I even saw the code, in order to have a reference of the loaded/updated object(s), so I do not have to re-create it after an activity has modified it.
What I mean by that is the following. Imagine you have a List activity, displaying a list of objects, the user selects one of them, a new activity launches that shows its details, they modify the object and save it to the server. Now, after the detail activity finishes, we need to update the list to reflect the changes.
Since in android there is no passing data objects around (unless they are parcable) we have to reload the list from the server to have the updated result.
Using what I have seen in the sample generated code, we can use that and get the reference of the updated object, and update our list through that.
Is that the way things should be done? Or is there another way?
Thank you for any responses!

Hi George,

If I understood your question correctly, you’re basically asking if it is a good idea to keep an app-wide static collection of objects so it is accessible from everywhere in the app. The collection would be updated as objects are saved on the server. Did I get it right?

Here’s a good discussion on static variables in Android:

Regards,
Mark

Hi Mark,

Yes you understood just fine, thank you for point me to that link. As I can understand from the discussion in that thread it is arguable of whether or not such pattern is safe to use. I guess it really depends on your implementation and how much you will use it.
I guess to answer my own question, use but not abuse would be the best answer I can come up with. If anyone has any other comments please fell free to share.

Regards,

George