Arkadaşlar merhaba ben bugun sizlerle android de asyntask işlemini göstermek istiyorum kodlar ekte vardır

public class Haber extends ActionBarActivity {

String HABER=””;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_haber);
Bundle bundle=getIntent().getExtras();
String url=bundle.getString(“url”);
String haber_baslik=bundle.getString(“haberbaslik”);
String haber = null;
Log.d(“Yol”,url);
init();
haberler shaber=new haberler(url,haber);
shaber.execute();
try {
HABER=shaber.get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
txtHaber.setText(txtHaber.getText()+haber_baslik);
txtHaber.setVisibility(View.VISIBLE);
}

TextView txtHaber;
private void init(){

txtHaber=(TextView)findViewById(R.id.txtHaber);
}
String yazi=” “;
private class haberler extends AsyncTask<String, String, String> {
String url,haber;
public haberler(String url,String haber){
this.url=url;
this.haber=haber;
}

@Override
protected void onPostExecute(String s) {
txtHaber.setText(yazi);
}

@Override
protected String doInBackground(String… params) {
Document document = null;
try {
document = Jsoup.connect(url).userAgent(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.1.25 (KHTML, like Gecko) Version/8.0 Safari/600.1.25”).get();
Elements sondakika=document.select(“h1”);
for (Element element:sondakika){
yazi+=element.ownText();
}
Elements sondak=document.select(“h2”);
for (Element element:sondak){
yazi+=element.ownText();
}
Elements sondakka=document.select(“p”);
for (Element element:sondakka){
yazi+=element.ownText();
}

haber=yazi;
HABER=yazi;
return yazi;
} catch (IOException e) {
e.printStackTrace();
return null;
}

}
}
private String getHaberler(String url){
String yazi=” “;
Document document = null;
try {
document = Jsoup.connect(url).userAgent(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.1.25 (KHTML, like Gecko) Version/8.0 Safari/600.1.25”).get();
Elements sondakka=document.select(“div.col-md-12 div.content p”);
for (Element element:sondakka){
yazi+=element.ownText();
}

} catch (IOException e) {
e.printStackTrace();
}
return yazi;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_haber, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}
}

iyi çalışmalar
Ramazan CESUR