Skip to content

Instantly share code, notes, and snippets.

@melihmucuk
Created October 1, 2013 21:47
Show Gist options
  • Save melihmucuk/6785657 to your computer and use it in GitHub Desktop.
Save melihmucuk/6785657 to your computer and use it in GitHub Desktop.
Android AsyncTask Example
public class asyncTaskOrnek extends AsyncTask<String,String,String>
new asyncTaskOrnek().execute(parametre);
new asyncTaskOrnek(parametre).execute();
new asyncTaskOrnek().execute();
@Override
protected String doInBackground(String... params) {
//Bu kısımda herhangi uzun sürecek bir işlem yapılır.
// Bu işlem sonucunda mutlaka bir sonuç return edilmelidir.
return UzunIslemSonucu;
}
protected void onPostExecute(String UzunIslemSonucu){
ornekText.setText(UzunIslemSonucu);
dialog.dismiss();
}
@Override
protected void onPreExecute() {
dialog.setMessage("Yükleniyor...");
dialog.show();
}
private ProgressDialog dialog = new ProgressDialog(Anasayfa.this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment