I am new to android to programming and i am following the code from the youtube video but i am getting error "cannot resolve the symbol "urls"" for " HttpGet httppost = new HttpGet(urls[0]);".I found out through research that the HttpGet is not supported any more in android is there any way around it
@Override
protected Boolean doInBackground(String... params) {
try {
HttpGet httppost = new HttpGet(urls[0]);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse respone = httpclient.execute(httppost);
int status = respone.getStatusLine().getStatusCode();
if (status == 200) {
HttpEntity entity = respone.getEntity();
String data = EntityUtils.toString(entity);
JSONObject jsono = new JSONObject(data);
JSONArray jarray = jsono.getJSONArray("forecast");
for (int i = 0; i < jarray.length(); i++) {
JSONObject object = jarray.getJSONObject(i);
Forecast forecast = new Forecast();
forecast.setCode(object.getString("code"));
forecast.setDate(object.getString("date"));
forecast.setDay(object.getString("day"));
forecast.setHigh(object.getString("high"));
forecast.setLow(object.getString("low"));
forecast.setText(object.getString("text"));
forecastList.add(forecast);
}
return true;
}
} catch (ParseException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
return false;
}
Just replace urls to params in your code if you don't define urls in previously in your code.