asynctask를 사용하여 일부 XML 작업을 수행하고 있지만 완료되면 textview를 업데이트하려고하지만 findViewById를 사용하여 textview를 참조 할 수없는 다음과 같은 문제가 발생합니다.Asynctask의 텍스트 뷰 참조하기
public class HTTPRequestTask extends AsyncTask<String , Void, String > {
@Override
protected String doInBackground(String... args) {
q = (TextView)findViewById(R.id.xmlData); //cannot resolve findViewbyId
그러면 게시 실행 방법에서 textview를 업데이트하고 싶습니다.
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);{
q.setText(s);
}
}
postExecute 메서드에서 텍스트를 설정할 수있는 가장 직접적인 방법은 무엇입니까 ??
당신의 코드는 ** 메모리 누출 **을 유발할 것입니다.이 경우'WeakReference'를 사용하십시오. – Enzokie