toto_tata
toto_tata

Reputation: 15432

AsyncTask leaks: Robospice and AndroidAnnotations

As explained by many developers, the AsyncTask have an inconvenient: they induce leaks in some situations (for example, when the screen is rotated (and thus the activity restarted) during the AsyncTask execution).

I would like to avoid the use of AsyncTask and use either:

OR:

Questions:

  1. Is Robospice compatible with AndroidAnnotations? (if I start with Robospice and want to use AndroidAnnotations later)
  2. Do the async methods in AndroidAnnotations have the same leaks as classical AsyncTask ?

Upvotes: 1

Views: 809

Answers (2)

javaxian
javaxian

Reputation: 2394

I actually use both libraries: RoboSpice for its service-based networking tasks and caching, and Android Annotations for getting rid of the boilerplate code, dependency injection and neatness. Recently I've written a blog post about combining the two in one app: http://blog.goyello.com/2014/06/26/androidannotations-robospice-the-best-of-both-worlds/. You'll find my sample on Github (https://github.com/ddekanski/SpiceAnnotations).

Upvotes: 1

marcelj
marcelj

Reputation: 597

  1. Simplifying REST APIs is only a small part of AndroidAnnotations and is basically a wrapper around Spring Android. If you don't plan to use that feature of AnroidAnnotations, it is fully compatible with RoboSpice.
  2. If you do your REST calls from a @Background method of your activity, you'll have the same leaks as with an AsyncTask.

Upvotes: 0

Related Questions