Making a web request and receiving a JSON request in android
1 answer
I'll leave you to display the results, but the first bit can be done like this:
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());
+8
source to share