new AsyncTask<Object, Object, Object>() {
@Override
protected Object doInBackground(Object[] objects) {
while (!CheckInternetConnection.getInstance(context).isOnline()) {
}
return null;
}
@Override
protected void onPostExecute(Object o) {
/*
Call some method in the DialogFragment to dismiss it.
*/
noInternetConnection.dismissDialog();
}
}.execute();
당신은을 사용한다
if(!CheckInternetConnection.getInstance(context).isOnline()){
NoInternetConnection noInternetConnection=new NoInternetConnection();
noInternetConnection.setContext(context);
noInternetConnection.show(fragmentManager,"NoInternetConnection");
while (!CheckInternetConnection.getInstance(context).isOnline());
}
참고 : 여기에
내 코드입니다
AysncTaskLoader 대신 AsyncTask를 사용하면이 스레드는 동시에 실행되지 않습니다. 또한 각 루프 사이에서 잠시 기다리는 것이 가장 좋습니다. 정확히
CheckInternetConnection
에서 무슨 일이 일어나고 있는지 잘 모르겠습니다. 건배!