5
DoInBackground İçinde uygulama bağlamına veya bir etkinliğe başvurmalıyım.AsyncTask doInBackground parametreleri vs yapıcı parametreleri
new MyAsyncTask(getApplicationContext())
ve doInBackground(Context... params)
arasındaki iplik güvenliği ve diğer olası çok dişli kavramlar, kısıtlamalar açısından bir fark var mı?
Teşekkürler.
private class MyAsyncTask extends AsyncTask<Context, Integer, Long> {
private Context _context = null;
MyAsyncTask(Context context) {
_context = context;
}
protected Long doInBackground(Context... context) {
// if _context and context are the same, it doesn't matter
// which you use.
return 0;
}
protected void onProgressUpdate(Integer... progress) {
// update progress
}
protected void onPostExecute(Long result) {
// publish result
}
}
Sonra wrt Bağlam kendisi çoklu iş parçacığı ilgili hiçbir içsel sorunları vardır: sizi varsayarsak
farkı anlatmak, Rahul @ http://developer.android.com/reference/android/os/AsyncTask.html –
bakınız – midnight