Skip to content
This repository has been archived by the owner on Jan 14, 2018. It is now read-only.

Starter guide

stephanenicolas edited this page Oct 24, 2012 · 28 revisions

You wanna see what RoboSpice looks like in action ? Great ! This is the page you are looking for.

RoboSpice usage

Configuring your project

Under Maven

Basically, you will want to add the RoboSpice library from maven central using this in your pom.xml file :

	<dependency>
		<groupId>com.octo.android.robospice</groupId>
		<artifactId>robospice</artifactId>
		<version>${robospice.version}</version>
	</dependency>

If you want to perform REST requests (using spring android), then you will add this instead :

	<dependency>
		<groupId>com.octo.android.robospice</groupId>
		<artifactId>robospice-spring-android</artifactId>
		<version>${robospice.version}</version>
	</dependency>

Now, you decide what kind of caching format you want to use :

Use one of these dependencies or a combination of them (version of dependencies are provided in the pom file of robospice-parent project:

for Json support via Jackson :

		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-mapper-asl</artifactId>
		</dependency>	

for Json support via Gson :

		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
		</dependency>

for XML support via XML Simple Serializer :

		<dependency>
			<groupId>org.simpleframework</groupId>
			<artifactId>simple-xml</artifactId>
			<exclusions>
		    	<exclusion>
		      		<groupId>xpp3</groupId>
		      		<artifactId>xpp3</artifactId>
	    		</exclusion>
		    	<exclusion>
		      		<groupId>stax</groupId>
		      		<artifactId>stax-api</artifactId>
	    		</exclusion>
  			</exclusions>			
		</dependency>	

for ORMLite support :

	<dependency>
            <groupId>com.j256.ormlite</groupId>
            <artifactId>ormlite-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.j256.ormlite</groupId>
            <artifactId>ormlite-android</artifactId>
        </dependency>	

Under Eclipse

Add the RoboSpice jars from the download section to your libs folder.

Under IntelliJ

TODO

Using RoboSpice

To use RoboSpice in your application, there are 4 steps :

  • 1 has to be performed once for all requests (creating a RoboSpice service) ;
  • 1 has to be done for every Activity class (or only once for your project if you use a common base class for all your activities) ;
  • and 2 steps have to be repeated for each requests (creating a request and a listener).

Creating a RoboSpice Service

Spice your activity

Create a request and a listener