Need help

19 views
Skip to first unread message

Bob S

unread,
Nov 24, 2014, 3:44:14 PM11/24/14
to robo...@googlegroups.com
I can't seem to get robospice working. I am going through the github starter guide.
I tried adding this to my androidmanifest.xml but get error 'cannot resolve symbol RetrofitGsonSpiceService':

<service
            android:name="com.octo.android.robospice.RetrofitGsonSpiceService"
            android:exported="false" />

I can use RetrofitGsonSpiceService in my code fine like this:

RetrofitGsonSpiceService service


Also, what should my Request class look like?
I have this but get errors 'cannot resolve method getRestTemplate()' and another error in the 'super(User.class)' line


public class TestRequest extends RetrofitSpiceRequest
{
    private String user;

    public TestRequest(String user) {
        super(User.class);
        this.user = user;
    }

    @Override
    public User loadDataFromNetwork() throws Exception {

        String url = String.format("https://api.github.com/users/%s/followers", user);

        return getRestTemplate().getForObject(url, User.class);
    }

    /**
     * This method generates a unique cache key for this request. In this case
     * our cache key depends just on the keyword.
     * @return
     */
    public String createCacheKey() {
        return "followers." + user;
    }
}

I have a User class that works fine with Retrofit and gson. I am just trying to get anything to work right now, ultimately I will need it to download a file from my server

Stéphane NICOLAS

unread,
Nov 24, 2014, 4:27:24 PM11/24/14
to robo...@googlegroups.com
Hi bob, did you have a look at our samples ? 
There in the repo's source tree.

There is one with Retrofit too. Your problem is that you get confused between the requests for SpringAndroid and Retrofit. Instead of a getRestTemplate, you should have a getRestAdapter.

S.

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "RoboSpice".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse robospice+...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Bob S

unread,
Nov 24, 2014, 4:59:19 PM11/24/14
to robo...@googlegroups.com
Yes I looked at the samples. Kind of frustrating looking at samples though since you don't know exactly where you need to look. You basically have to look at every file instead of just looking at the essential parts. But I'll try looking at them again. Thanks
Reply all
Reply to author
Forward
0 new messages