AsyncTask를 확장하는 클래스가 있습니다.클래스에서 SendBroadcast AsyncTask를 확장 할 수 있습니까?
하는 배경 작업이 완료되면, 게시물에 내가 배경을하고 결과를 동일하게 다른 클래스의 정적 속성을 얻을 실행, n은 그래서 다른 클래스의에 수신기가 갱신 인터페이스
될 것이라고 IT를 OUT 방송 싶지 여기제가 sendBroadcast 방법을 쓸 수 후 onPostExecuted
protected void onPostExecute(String result) {
Log.d(tag, "post executed "+result);
// do sth here
if (result != null){
result = result.trim();
String temp_result[];
if (result.contains("|")){
temp_result = result.split("\\|");
MyGPS.location_info = temp_result[1];//
Log.d(result, "contains | : "+MyGPS.location_info);
}else if (result.equalsIgnoreCase("300 OK")){
Log.d(result, "in 300 OK BUT UNKNOWN : "+ result);
MyGPS.location_info = "Unknown";
}else if (result.equalsIgnoreCase("400 ERROR"))
Log.d(result, "400 ERROR : "+ result);
else Log.d(result, "else : "+ result);
//assemble data bundle to be broadcasted
//myFilteredResponseThread = new Intent(GPS_FILTER);
myFilteredResponseThread.putExtra("location_info_post",
MyGPS.location_info);
// CAN"T USE SEND BROADCAST METHOD ?
//myFilteredResponseThread.
//Log.e(">>GPS_Service<<", "location_info"+MyGPS.location_info);
}
}
의 코드, 그 이유는 정의되지?
은 AsyncTask를 확장이 클래스에 활동 상황을 전달하지 않습니다 수 있습니다. 당신이 활동 컨텍스트를 전달하는 경우 context.sendbroadcat (intent) – Vivek
을 사용합니다. 내 내부 GPSListener에서이 스레드 AysnctTask를 호출하여 LocationListener를 구현하고이 내부 클래스가 클래스 확장 서비스에 있으므로 내 AsyncTask에 컨텍스트를 전달할 수 있습니까? thx – sayvortana