/** * This method retrieves the search text from the EditText, constructs * the URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays * that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using * our (not yet created) {@link GithubQueryTask} */ private void makeGithubSearchQuery() { String githubQuery = mSearchBoxEditText.getText().toString(); URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); // COMPLETED (2) Call getResponseFromHttpUrl and display the results in mSearchResultsTextView // COMPLETED (3) Surround the call to getResponseFromHttpUrl with a try / catch block to catch an IO Exception String githubSearchResults = null; try { githubSearchResults = NetworkUtils.getResponseFromHttpUrl(githubSearchUrl); mSearchResultsTextView.setText(githubSearchResults); } catch (IOException e) { e.printStackTrace(); } }
/** * This method retrieves the search text from the EditText, constructs * the URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays * that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using * our (not yet created) {@link GithubQueryTask} */ private void makeGithubSearchQuery() { String githubQuery = mSearchBoxEditText.getText().toString(); URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); }
@Override protected String doInBackground(URL... params) { URL searchUrl = params[0]; String githubSearchResults = null; try { githubSearchResults = NetworkUtils.getResponseFromHttpUrl(searchUrl); } catch (IOException e) { e.printStackTrace(); } return githubSearchResults; }
/** * This method retrieves the search text from the EditText, constructs the * URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays * that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using * our {@link GithubQueryTask} */ private void makeGithubSearchQuery() { String githubQuery = mSearchBoxEditText.getText().toString(); URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); // COMPLETED (4) Create a new GithubQueryTask and call its execute method, passing in the url to query new GithubQueryTask().execute(githubSearchUrl); }
@Override protected String doInBackground(URL... params) { URL searchUrl = params[0]; String githubSearchResults = null; try { githubSearchResults = NetworkUtils.getResponseFromHttpUrl(searchUrl); } catch (IOException e) { e.printStackTrace(); } return githubSearchResults; }
/** * This method retrieves the search text from the EditText, constructs * the URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays * that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using * our (not yet created) {@link GithubQueryTask} */ private void makeGithubSearchQuery() { String githubQuery = mSearchBoxEditText.getText().toString(); URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); // COMPLETED (2) Call getResponseFromHttpUrl and display the results in mSearchResultsTextView // COMPLETED (3) Surround the call to getResponseFromHttpUrl with a try / catch block to catch an IOException String githubSearchResults = null; try { githubSearchResults = NetworkUtils.getResponseFromHttpUrl(githubSearchUrl); mSearchResultsTextView.setText(githubSearchResults); } catch (IOException e) { e.printStackTrace(); } }
/** * This method retrieves the search text from the EditText, constructs the * URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays * that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using * our {@link GithubQueryTask} */ private void makeGithubSearchQuery() { String githubQuery = mSearchBoxEditText.getText().toString(); URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); new GithubQueryTask().execute(githubSearchUrl); }
@Override protected String doInBackground(URL... urls) { URL searchUrl = urls[0]; String githubSearchResults = null; try { githubSearchResults = NetworkUtils.getResponseFromHttpUrl(searchUrl); } catch (IOException e) { e.printStackTrace(); } return githubSearchResults; }
/** * This method retrieves the search text from the EditText, constructs the * URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays * that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using * our {@link GithubQueryTask} */ private void makeGithubSearchQuery() { String githubQuery = mSearchBoxEditText.getText().toString(); URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); new GithubQueryTask().execute(githubSearchUrl); }
@Override protected String doInBackground(URL... params) { URL searchUrl = params[0]; String githubSearchResults = null; try { githubSearchResults = NetworkUtils.getResponseFromHttpUrl(searchUrl); } catch (IOException e) { e.printStackTrace(); } return githubSearchResults; }
/** * This method retrieves the search text from the EditText, constructs the URL * (using {@link NetworkUtils}) for the github repository you'd like to find, displays * that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using * our (not yet created) {@link GithubQueryTask} */ private void makeGithubSearchQuery() { String githubQuery = mSearchBoxEditText.getText().toString(); URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); // COMPLETED (4) Create a new GithubQueryTask and call its execute method, passing in the url to query new GithubQueryTask().execute(githubSearchUrl); }