public class asynctask extends AsyncTask <Void, String, Void > {
String title;
@Override
protected Void doInBackground(Void... params) {
try {
Document document = Jsoup.connect(url).get();
title = document.title();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
TextView campotesto = (TextView) findViewById(R.id.text);
campotesto.setText(title);
}
}}
Every time i run this get a nullpointer exception on the settext line and on the line in which i create the asynctask class