Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 => ?