开发者

Making a web request and getting request in JSON format in android

I am trying to accomplish the task of

Making a Web request ->getting result in JSON format ->Parsing the result 开发者_Python百科 -> and finally display the result in a table....

Any help regarding any of the task is welcome....


I'll leave you to display the results, but the first bit can be accomplished as follows:

URLConnection connection = new URL("http://example.com/someService.jsp").openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()), 1024 * 16);
StringBuffer builder = new StringBuffer();
String line;
while ((line = reader.readLine()) != null) {
  builder.append(line).append("\n");
}
JSONObject object = new JSONObject(builder.toString()); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜