나는 내 데이터베이스에 데이터를 게시하는 안드로이드 애플 리케이션을 작성했습니다. 앱은 데이터를 데이터베이스에 게시하는 웹 서비스에 액세스해야합니다. webservice 잘 작동합니다. 내 브라우저에서 테스트 해 본다면 이미 서버에 있습니다. 지금은 내 애플 리케이션 webservice를 실행하고 싶습니다. 하지만 그 doesnt 일. 내 디버거가 작동하지 않으므로 디버깅 할 수 없습니다. 여기 내 코드 webservice에 액세스하는 것입니다. 어떤 아이디어? 클래스가HTTP 요청에서 응답 없음
new PostBlog(insertBlogURL).execute("");
에 의해 내 주요 활동에서 호출
public class PostBlog extends AsyncTask<String, Void, String> {
String BlogURL;
public PostBlog(String insertBlogURL) {
BlogURL = insertBlogURL;
}
@Override
protected String doInBackground(String... params) {
postBlogData(BlogURL);
return null;
}
public void postBlogData(String url) {
String result = "";
//the year data to send
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("year", "1980"));
//http post
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
result = sb.toString();
} catch (Exception e) {
//(TextView)rootView.findViewById(R.id.question)
Log.e("log_tag", "Error converting result " + e.toString());
}
}
}는 서버에 내 ".jsp로? asdd = sdsd"파일을 실행하는 또 다른 쉬운 방법이 있습니까?
의견을 보내 주셔서 감사합니다.
앱을 디버그 할 수없는 경우 로그 만 추가하면됩니다. 그리고 로그가 말하는 것을 말해주십시오. – deathangel908
로그를 추가하는 방법 및 위치는 어디입니까? – theAlgorithmGod
https://developer.android.com/reference/android/util/Log.html 결과가 무엇인지 알 수없는 모든 행이 나온 후에. 그리고 만약 당신이 안드로이드를 공부하고 있다면 디버거와 잘 지내야합니다. stackoverflow에 질문을 게시하면 문제가 무엇인지 이해할 수없는 경우 도움이되지 않습니다. – deathangel908