mercredi 30 mars 2016

weakreference vs eventbus to avoid memory leaks android?

I am developing an application in which I am using retrofit library for calling the web services . After calling web-service a callback return Response then I am passing the Response to the next activity. I want to know the best approach for this .

I am new in memory related problems please correct me if I am totally wrong.

Shall I make a new class then pass a weak reference to that class and call the function from that class on the main activity.

Or

I shall register a new event on event bus and when the callback returns the object ,fire the event and call the function.

Please consider what is good to avoid Memory Leaks.

Aucun commentaire:

Enregistrer un commentaire