Android: Can not send http post

后端 未结 4 697
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 07:02

I\'ve been banging my head trying to figure out how to send a post method in Android. This is how my code look like:

public class HomeActivity extends Activi         


        
4条回答
  •  渐次进展
    2021-01-01 07:44

    it seems that AndroidHttpClient is responsible for that exception. Your example will work

    • if use set the 'INTERNET' persmission as suggested
    • replace 'AndroidHttpClient' with 'DefaultHttpClient'
    • remove the line 'Log.i(HomeActivity.class.toString(), result);' because result is null

    It is not clear to me why this class does not work as excpected, maybe somebody could explain. This thread discussed the problem too but there is also no explaination why the code fails: http://groups.google.de/group/android-developers/browse_thread/thread/cc59efb9475ac557/81116369f2c6bd7a?hl=de&lnk=gst&q=This+thread+forbids+HTTP+requests#81116369f2c6bd7a.

提交回复
热议问题