What is RoboSpice Library in android
Asked Answered
N

1

8

I am Trying to understand RoboSpice Library in android


I saw the online Documentation here


What i tried::

  • I have previously studying on using Spring Library,also Retrofit, AsyncHttp etc
  • I understood that all above convert JSON response to POJO

What i need more information::

  • When i see the documentation on Robospice it looks like a wrapper around either of Spring or Retrofit or AsyncHttp etc
  • Is it true ?
  • So by using RoboSpice can we select the underlying layer to be Spring or Retrofit or AsyncHttp etc
  • So if that happens RoboSpice makes Spring or Retrofit or AsyncHttp etc as BoilerPlate code and makes development easier

If i am not correct, please provide a clear info w.r.t this


I am new to android, Please go easy on with answers

Neoplasty answered 15/4, 2014 at 14:43 Comment(0)
T
15

I'm not an expert on RoboSpice but here is my quick explanation of its function:

Often in our app we would like to do Asynchronous network operations (get image from url etc.)

A common technique is to do the network request within an AsyncTask object.

The problem is that the AsyncTask object is not handled by the activity lifecycle.

When the device configuration change occurs (e.g. rotate device) a new activity is created (See Handling runtime changes). The original activity which created the Async network request is destroyed now but the AsyncTask is still working. The AsyncTask which is doing the networking will now maybe try and update the UI with some progress information (e.g. download has completed). But the AsyncTask still refers to the original activity which has been destroyed now. We need the AsyncTask to attach itself to the new activity.

My knowledge is that RoboSpice helps solve this problem. I cannot comment on the underlying implementation of RoboSpice.

Tune answered 15/4, 2014 at 15:51 Comment(4)
Thanks for valuable info [+1]...... Also what other ways can i handle the runtime changes in android apart from robospice and which is the best one to use like(cursor adapter, endless adapter ... etc) for handling runtime changesNeoplasty
In Android these runtime changes are known as "config changes." There are a number of ways to handle config changes. The recommended way to handle these changes is by using Fragments, because it is possible for fragments to be kept alive after a config change. There are many tutorials online which explain how Fragments can be used, a quick google search should give you all of the information you need.Tune
I'm also new to Robospice and I think it can do everything that Spring Android (the underlying) can do and more. Have a look here: github.com/stephanenicolas/robospice/wiki/Spring-Android-moduleJunie
Can anyone let me know, shall I use okhttp3 instead of robospice. Or shall I need to use retrofit + okhttp3+ rxjava to acheive the robospice fuctionality?Gaeta

© 2022 - 2024 — McMap. All rights reserved.