제 코드에 이상이 있는 거겠죠...정말 단순하게 Price=50000을 php로 보내서 echo로 'Price is $price won' 출력 하려구 했거든요.메인 Activity에서 Send.execute();호출 하구요.AsyncTask는 따로 클래스를 만들어서 객체 생성 해서 호출한 겁니다. 자꾸 isDataSchedulerEnabled():false가 뜹니다..
public class Send extends AsyncTask<Void, Void, String>{
@Override
protected String doInBackground(Void... price) {
// TODO Auto-generated method stub
try {
executeClient();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public String executeClient() throws MalformedURLException {
// TODO Auto-generated method stub
ArrayList<NameValuePair> post = new ArrayList<NameValuePair>();
post.add(new BasicNameValuePair("price", "50000"));
URL target = new URL("http://ip주소/price.php");
try {
HttpURLConnection conn = (HttpURLConnection) target.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
OutputStream outStream = conn.getOutputStream();
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(outStream, "UTF-8"));
writer.write(getQuery(post));
writer.flush();
writer.close();
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
private String getQuery(List<NameValuePair> params) throws UnsupportedEncodingException
{
StringBuilder result = new StringBuilder();
boolean first = true;
for (NameValuePair pair : params)
{
if (first)
first = false;
else
result.append("&");
result.append(URLEncoder.encode(pair.getName(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode(pair.getValue(), "UTF-8"));
}
return result.toString();
}
}
어떤 부분이 잘못된 것일까요 ㅠㅠ..
또한 php에서 echo로 출력되는 것을 안드로이드에서 받아오고 싶은데, Toast로도 가능할까요?
아래는 php코드입니다...
<?php
$price = $_REQUEST['price'];
echo "price is $price won";
?>
06-04 16:14:12.979: I/ViewRootImpl(22116): ViewRoot's Touch Event : Touch Down
06-04 16:14:13.079: I/ViewRootImpl(22116): ViewRoot's Touch Event : Touch UP
06-04 16:14:14.621: D/BubblePopupHelper(22116): isShowingBubblePopup : false <-(엄청 많이 뜸)
06-04 16:14:14.621: I/ViewRootImpl(22116): ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BACK, scanCode=158, metaState=0, flags=0x48, repeatCount=0, eventTime=37489778, downTime=37489778, deviceId=7, source=0x101 } to com.android.internal.policy.impl.PhoneWindow$DecorView{429ceba0 V.E..... R....... 0,0-1080,1920}
06-04 16:14:14.711: D/BubblePopupHelper(22116): isShowingBubblePopup : false
06-04 16:14:14.711: I/ViewRootImpl(22116): ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_BACK, scanCode=158, metaState=0, flags=0x48, repeatCount=0, eventTime=37489875, downTime=37489778, deviceId=7, source=0x101 } to com.android.internal.policy.impl.PhoneWindow$DecorView{429ceba0 V.E..... R....... 0,0-1080,1920}
06-04 16:14:14.741: D/BubblePopupHelper(22116): isShowingBubblePopup : false
06-04 16:14:14.751: D/BubblePopupHelper(22116): isShowingBubblePopup : false
06-04 16:14:15.402: I/ViewRootImpl(22116): ViewRoot's Touch Event : Touch Down
06-04 16:14:15.482: I/ViewRootImpl(22116): ViewRoot's Touch Event : Touch UP
06-04 16:14:15.682: E/DataScheduler(22116): isDataSchedulerEnabled():false
이것은 SessionFilter에 있던 내용들이구요!