我不知道。它是android还是php错误?
我的PHP版本:5.3.10 apache版本:2.2.21
我的安卓代码:
HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 500000);
HttpConnectionParams.setSoTimeout(client.getParams(), 500000);
HttpUriRequest request = new HttpGet(CategoryAPI);
HttpResponse response = client.execute(request);
InputStream atomInputStream = response.getEntity().getContent();
BufferedReader in = new BufferedReader(new InputStreamReader(atomInputStream));
String line;
String str = "";
while ((line = in.readLine()) != null){
str += line;
}
// parse json data and store into arraylist variables
JSONObject json = new JSONObject(str);
JSONArray data = json.getJSONArray("data");
for (int i = 0; i < data.length(); i++) {
JSONObject object = data.getJSONObject(i);
JSONObject feed = object.getJSONObject("Feeds");
FeedItem.allFeedItemsList.add(new FeedItem(Integer.parseInt(feed.getString("id")), feed.getString("name"), feed.getString("post_img"), feed.getString("post_description"), feed.getString("userimage"), feed.getString("post_date"), feed.getString("post_title")));
}
任何人都可以提供帮助???????????
答案 0 :(得分:0)
现在我可以通过ANSI编码来解决我的错误。由于我在UTF-8中编码,因此android无法加载。现在,这很好,没问题。感谢.......
答案 1 :(得分:0)
尝试使用此库: - https://github.com/Abhishekpalodath/FetchServerUtil-Android.git。 您还可以使用此功能加载实时数据。