我是Java的新手,並嘗試使本機android應用程序,其中包括進行API調用API服務器。現在我的問題是,用一些JSON數據調用HTTP POST(apache httpPost和httpClient)。因此,爲了使StringEntity出來的JSONObject的我寫這行代碼:來自JSONObject的StringEntity對象給出了java.io.UnsupportedEncodingException
StringEntity userDataStringEntity = new StringEntity(userDataString);
凡StringEntity從import org.apache.http.entity.StringEntity;
進口。
我已經試過尋找這個問題,我找到了相同的「字符串」參數相同的方法。
這裏有一些聯繫,但它並沒有幫助我:
How to send a JSON object over HttpClient Request with Android?
How to send a JSON object over Request with Android?
嘿馬里奧,感謝您的回答。我也明白這一點..還有一件事,還有未處理異常的錯誤。 – jimish 2015-02-24 04:41:02
@Jimish很高興知道:)當然不是未處理的異常,但是你知道了;) – 2015-02-24 07:22:42