사용자가 로그인 버튼을 클릭하면 웹 서비스에 충돌하고 싶습니다. 나는 그렇게하기 위해 다음과 같은 코드를 가지고있다.가 호출되지 않음 : onPostExecute
public void onClick(final View view) {
String orgKey = inputCompany.getText().toString();
new getAppInfo().execute("http://example.webservice.com");
은 여기 내 getAppInfo
private class getAppInfo extends AsyncTask<String, Void, String> {
/** The system calls this to perform work in a worker thread and
* delivers it the parameters given to AsyncTask.execute() */
@Override
protected String doInBackground(String... urls) {
String xml = null;
try {
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(urls[0]);
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
xml = EntityUtils.toString(httpEntity);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// return XML
return xml;
}
/** The system calls this to perform work in the UI thread and delivers
* the result from doInBackground() */
@Override
protected void onPostExecute(String result) {
Document doc = GetDomElement(result); // getting DOM element
NodeList nl = doc.getElementsByTagName("details");
getChildElements(nl);
}
doBackground
가 실행되고 있지만 onPostExecute
아니다. 나는 클릭에서 그것을 옮겼고 효과가 있었지만 onClick 안에 필요합니다.
내 onClick 내에서 onPostExecute
을 실행하려면 어떻게해야합니까?
당신이 또한 OutOfMemoryError를 얻고 있을지도 모르다 - 당신이 또한 안드로이드 (자바에 다른)에서 붙잡을 수있는 큰 경우에 – siliconeagle
또한, 당신은 당신의 매니 페스트에있는 인터넷 허가가다는 것을 확인한다 – siliconeagle
통보를위한 감사합니다 – BigT