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 trialMike Hansen
Python Web Development Techdegree Student 3,419 PointsFailed to set EGL_SWAP_BEHAVIOR on surface 0xad99c660, error=EGL_SUCCESS
I get this message everytime i start the app. My code: package com.dellongcompany.weathercheck;
import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log;
import java.io.IOException;
import okhttp3.Call; import okhttp3.Callback; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response;
public class MainActivity extends AppCompatActivity {
public static final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String apiKey = "06d0f8a752e272555904f6d3fc9a8a74";
double latitude = 37.8267;
double longitude = -122.423;
String forecastUrl = "https://api.forecast.io/forecast//" + apiKey + "/" + latitude + "," + longitude;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(forecastUrl).build();
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 {
if (response.isSuccessful()) {
Log.v(TAG, response.body().string());
}
} catch (IOException e) {
Log.e(TAG, "Exception Caught: ", e);
}
}
});
}
}
Pamela Alvarez
5,681 PointsPamela Alvarez
5,681 PointsHello, I'm not sure if you still need assistance. But your error is within the url you wrote for String forecast. You have double slash
String forecastUrl = ("https://api.forecast.io/forecast//")
When its suppose to only consist of one slash. Like so:
String forecastUrl = ("https://api.forecast.io/forecast/")
maybe that would help.~