Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App Working with JSON Setting CurrentWeather from JSON

Debugger can never enter call.enqueue

So this is my code Call call = client.newCall(request);

        call.enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                try {
                    String jsonData = response.body().string();
                    Log.v(TAG, jsonData);
                    if (response.isSuccessful()) {

                        currentWeather = getCurrentDetails(jsonData);

                    } else {
                        alertUserAboutError();
                    }
                } catch (IOException e) {
                    Log.e(TAG, "IO Exception caught: ", e);
                } catch (JSONException e) {
                    Log.e(TAG, "JSON Exception caught: ", e);
                }
            }

        });

Why I tried the debugger by the end of the video, I realized my debugger never really got to getCurrentDetails(jsonData). By checking, I noticed that the debugger just skipped the code after call.enqueue(new Callback(). How can I fix this? Thank you.

2 Answers

Well problem solved. Looks like there's a problem with the emulator so I reinstalled it and it works.

I'm not familiar with this language, but aren't you missing the => ?