Reputation: 6540
This is a part of my function:
public void getUrls(String category) {
try {
String url = "my_url"
URL imagesJSON = new URL(url);
HttpURLConnection conn = (HttpURLConnection) imagesJSON.openConnection();
conn.setConnectTimeout(30000);
conn.setReadTimeout(30000);
conn.setInstanceFollowRedirects(true);
InputStream is = conn.getInputStream();
conn.disconnect();
I expect to get JSON data from a server and return it to another function. I gonna get some URLs from this JSON and return them. I am wondering which type should this function be and if I should use some function to format recieved object to operate on in properly. I will be grateful for some clues and tips.
Upvotes: 1
Views: 25