Not sure exactly what you're trying to do here, but theThe url in JsonObjectRequest() is not optional. The, and the JSONObject parameter is used to post parameters with the request to the url.
Using Http URL ConnectionHttpURLConnection:
public class getData extends AsyncTask<String, String, String> {
HttpURLConnection urlConnection;
@Override
protected String doInBackground(String... args) {
StringBuilder result = new StringBuilder();
StringBuilder jsonStr = new StringBuilder();
try {
URL url = new URL("https://api.github.com/users/dmnugent80/repos");
urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = reader.readLine()) != null) {
result.append(line);
}
}catch( Exception e) {
e.printStackTrace();
}
finally {
urlConnection.disconnect();
}
return result.toString();
}
@Override
protected void onPostExecute(String result) {
//Do something with the JSON string
}
}