View our Data Sheet here

Developer Tools

Code Fundamentals

The samples below demonstrate how to write code to leverage the genreated pojos to fetch typesafe objects from the Splicer server. It documents the API for our simple SDK. For higher-level usage like displaying arrays of data, see the javadoc above.

Droid MVC Design
A good reference for droid MVC design (“Programming Android”) states that the Adapters loosely serve as the Controller. For the model layer, we propose that the model should be orthogonal such that it can be changed globally. Also, the generated model code needs to be seperate from our functional code.

Droid Adapters
Once the project is setup correctly, your Adapters can instantiate the generic JsonFetcher to fetch data from the network:

private void loadData(){ 
    JsonFetcher<User[]> asyncTask = new JsonFetcher<User[]>(this, User[].class, "/users");
    asyncTask.execute(new Object[0]);//pass no arguments

You then implement the WebserviceRequestor interface…

public class MyActivity extends Activity implements WebserviceRequestor<User[]> {

and walah: the service returns an array of your Users via the onNetworkSuccess callback. Typically, you would then assign that array to a class member variable and then invalidate the view:

public void onNetworkSuccess(User[] retval) {
	//set the model member
	this.currentModel = Arrays.asList(retval);
	// invalidate the view