Profile cover photo
Profile photo
sun burnt
Communities and Collections
View all

Post has shared content
Ash!  Are you still in Europe?  Where are you?  I'm in Italy.
Surf shop in Munich German? They surf rivers here :-) Next time I bring my board!
2 Photos - View album
Add a comment...

How might I mix Retrofit, Otto, and an object cache together?  

Do you keep a singleton restService class around?  This class would handle retrofit callbacks, update the object cache, and notify via Otto.  Sound right or too much?

Up until now I have each Activity (really each presenter. using mvp) interact with a single rest service command / callback.  The presenter could also update the cache and notify via Otto.  However, the activity lifetime does not match the lifetime of a retrofit request.  retrofit requests cannot be canceled.

Hang on. now that I write this I remember you wrote your controllers (presenters?) are singletons.  So they live on without being bound to activities?  In that case they can just wait for the retrofit response.  And so... no need for the central retrofit listener.

Suggestions on how to mix these three in an app would help a bunch. Thanks!

Any way to cancel a request?  I see issue 119, and the related code.  But I don't see how to use it. 

I'd like to hear how y'all solve passing objects between Activities within a process.

For example.  I've got EditListingActivity.    I'd like to pass in a Listing from a prior ViewListingActivity.

Hackborne suggests a singleton Map<String, WeakReference<T>> stash sort of thing.  

Could Otto help here?   If not, what is a good technique?

I don't want to Serialize / make Parcelable.  


Anyone have a way to autogen the retrofit method declarations based on a .api file from Google cloud endpoints?

Or how about an Apache thrift definition file?

Hmm maybe this is getting too lazy?  Still... I write them once on the server.  Would be nice to not have to write it again on the client.

Anyone try mixing Volley and OKHttp?  Does that even make sense?

Seems like Volley has a disk cache.  Dunno about OKHttp.  Volley has lots of features around batch canceling requests.  Dunno about OKHttp.  Volley seemed to have a lot of thought around threads & when to check the cache.  Also tricks like limiting threads to # cores.  I can't remember the rest.. too late here.  

thank you fellas!

Post has attachment
Hmm.  Why pass around the whole object at all?  Why not just pass an ID & then reference an in-memory object store. 

For each of your types you can keep a map:

Map<String, T>

where String is your ID.

referencing a live object must be much faster than either parceling it or serializing it.
Parcelable versus Serializable
Parcelable versus Serializable
Add a comment...
Wait while more posts are being loaded