java - Error: RestAdapter(...) has private access in 'retrofit.RestAdapter' -
i trying make class uses retrofit make api calls.
public class redditutils { private restadapter restadapter; private redditapiservice service; private final string redditbaseurl = "https://oauth.reddit.com"; public redditutils() { restadapter = new restadapter().builder().setendpoint(redditbaseurl).build(); service = restadapter.create(redditapiservice.class); } public void fetchtoken(string token) { service.gettoken(token, new callback<redditaccesstoken>() { @override public void success(redditaccesstoken redditaccesstoken, response response) { log.d("redditaccesstoken", redditaccesstoken.getaccesstoken()); } @override public void failure(retrofiterror error) { log.d("redditaccesstokenfailed", error.tostring()); } }); }
}
when set restadapter equalt new restadapter(), error
restadapter(*long path name*) has private access in 'retrofit.restadapter'
i not sure causing error , haven't found else issue. ideas on how solve error?
you aren't suppose instantiate restadapter
, hence why has private constructor.
builder
static internal class of restadapter
class. can instantiate so:
new restadapter.builder()
Comments
Post a Comment