I've got this code inside my main class:
public class vurlDownloader extends AsyncTask<Void, Void, String> {
@Override
protected String doInBackground(Void... params) {
HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet httpGet = new HttpGet("http://url/video.html");
HttpResponse response = null;
try {
response = httpClient.execute(httpGet, localContext);
} catch (IOException e) {
e.printStackTrace();
}
String result = "";
BufferedReader reader = null;
try {
reader = new BufferedReader(
new InputStreamReader(
response.getEntity().getContent()
)
);
} catch (IOException e) {
e.printStackTrace();
}
String line = null;
try {
while ((line = reader.readLine()) != null){
result += line + "\n";
}
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
}
public String loadVurl(){
String output = new vurlDownloader().execute().get();
return output;
}
and in this line
String output = new vurlDownloader().execute().get();
Android Studio gives me strange reference (red underline):
Unhandled exceptions: java.lang.InterruptedException, java.util.concurrent.Execution.Exception
I don't quite understand this, becouse I've got simillar situation as here: How to get a string back from AsyncTask? and for this person it works.
Greetings!