Skip to content

Commit 1492645

Browse files
authored
Update DataTask.java
Updated onPostExecute with the response from the network call in doInBackground.
1 parent c03209a commit 1492645

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

HowToDetectInternetConnectivityInAndroid/DataTask.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ public void onPreExecute() {
7777
* Returns the result from doInBackground and notifies the MainActivity on the main thread.
7878
* <_, _, String> in the AsyncTask declaration.
7979
*
80-
* @param String result : returned from the doInBackground method.
80+
* @param String response : returned from the doInBackground method.
8181
*/
82-
public void onPostExecute(String result) {
82+
public void onPostExecute(String response) {
8383
String status = "Online";
8484
// Not a long term solution, but one technique could be to check for (UnknownHostException).
85-
if (result.contains("UnknownHostException")) {
85+
if (response.contains("UnknownHostException")) {
8686
status = "Offline";
8787
}
8888
this.mainActivityInterface.notifyMainActivity("Connection Status: " + status,
89-
result);
89+
response);
9090
}
9191

9292
}

0 commit comments

Comments
 (0)