0

I must explain first what I have been doing for the existing version of my app : Activity needs some data from web -> Pass request bundle to an IntentService -> IntentService forms a JSON/XML request from the bundle & makes a GET/POST call to the web endpoint -> When response received, the IntentService publishes corresponding event (I am using EventBus) -> The subscribers of this event (may be activities or others) get the event and process it.

I want to migrate to Volley (or Picasso+Retrofit) because until now there was no image loading in my app, I was just consuming RESTful services. With image loading, I am afraid of memory leaks.

The problem : In my existing setup, I have the activity and service layers decoupled. But when I look at the Volley (or Picasso) samples, especially the image loading part, I see them using the views in the networking part (NetworkImageView for Volley and "into" method in Picasso). It seems un-natural to me to pass the views from my existing Activity to the Service (which will then consume Volley/Picasso to load images). Am I mis-understanding something about these libraries ? Or passing the views to services makes sense ? Or should I change my existing design ? Any example would help !

dev
  • 11,071
  • 22
  • 74
  • 122
  • Using Picasso is so simple, you can't really describe it as "migrating". It's just one line of code. Here .. http://stackoverflow.com/a/24076798/294884 IMPORTING Picasso is quite tricky, heh! here .. http://stackoverflow.com/questions/24024847 – Fattie Jun 29 '14 at 09:31

1 Answers1

1

Picasso supports any arbitrary Target, not just Views. You could be using that within your Service.

Your Service in general should not know about views. I don't see the connection or problem here with using Picasso.

dnkoutso
  • 6,041
  • 4
  • 37
  • 58