Could you guys give me a little push here. I'm stuck trying to run the yelp api inside the onPerformSyn.
How can I possible do this. I'm getting the error below. Please help is appreciated. public class SyncAdapter extends AbstractThreadedSyncAdapter{ public final String LOG_TAG = SyncAdapter.class.getSimpleName(); public static final int SYNC_INTERVAL = 4;//60 * 180; public static final int SYNC_FLEXTIME = SYNC_INTERVAL/3; private static final long DAY_IN_MILLIS = 1000;//1000 * 60 * 60 * 24; private static final int WEATHER_NOTIFICATION_ID = 3004; private GoogleApiClient mGoogleApiClient; private YelpAPI yelpAPI; private Location mLastLocation; public SyncAdapter(Context context, boolean autoInitialize) { super(context, autoInitialize); // YelpAPIFactory apiFactory = new YelpAPIFactory(BuildConfig.YELP_CONSUMER_KEY, BuildConfig.YELP_CONSUMER_SECRET, BuildConfig.YELP_TOKEN, BuildConfig.YELP_TOKEN_SECRET); // yelpAPI = apiFactory.createAPI(); } @Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { class YelpApi2 extends DefaultApi10a { @Override public String getAccessTokenEndpoint() { return null; } @Override public String getAuthorizationUrl(Token arg0) { return null; } @Override public String getRequestTokenEndpoint() { return null; } } class Yelp { OAuthService service; Token accessToken; public Yelp(String consumerKey, String consumerSecret, String token, String tokenSecret) { this.service = new ServiceBuilder().provider(YelpApi2.class).apiKey(consumerKey).apiSecret(consumerSecret).build(); this.accessToken = new Token(token, tokenSecret); } public String search(String term, double latitude, double longitude) { OAuthRequest request = new OAuthRequest(Verb.GET, "http://api.yelp.com/v2/search"); request.addQuerystringParameter("term", term); request.addQuerystringParameter("ll", latitude + "," + longitude); this.service.signRequest(this.accessToken, request); Response response = request.send(); return response.getBody(); } } Yelp yelp = new Yelp(BuildConfig.YELP_CONSUMER_KEY, BuildConfig.YELP_CONSUMER_SECRET, BuildConfig.YELP_TOKEN, BuildConfig.YELP_TOKEN_SECRET); String response = yelp.search("church", 30.361471, -87.164326); System.out.println(response); } Error I'm getting ========================================= FATAL EXCEPTION: SyncAdapterThread-1 Process: mem.edu.joshua, PID: 14149 org.scribe.exceptions.OAuthException: Error while creating the Api object at org.scribe.builder.ServiceBuilder.createApi(ServiceBuilder.java:59) at org.scribe.builder.ServiceBuilder.provider(ServiceBuilder.java:45) at mem.edu.joshua.sync.SyncAdapter$1Yelp.<init>(SyncAdapter.java:99) at mem.edu.joshua.sync.SyncAdapter.onPerformSync(SyncAdapter.java:116) at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259) Caused by: java.lang.InstantiationException: can't instantiate class mem.edu.joshua.sync.SyncAdapter$1YelpApi2; no empty constructor at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1208) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/69d490ab-ce17-4ae9-899f-056b3ad4719d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.