Created
March 19, 2021 19:04
-
-
Save nuriyevn/1267b4cadcc91c3e9184e9274a74670c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.downloadwebcontent; | |
import androidx.appcompat.app.AppCompatActivity; | |
import android.os.AsyncTask; | |
import android.os.Bundle; | |
import android.util.Log; | |
import java.util.concurrent.ExecutionException; | |
public class MainActivity extends AppCompatActivity { | |
public class DownloadTask extends AsyncTask<String, Void, String> { | |
@Override | |
protected String doInBackground(String... urls) { | |
Log.i("URL", urls[0]); | |
return null; | |
} | |
} | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
DownloadTask task = new DownloadTask(); | |
String htmlCode = ""; | |
try { | |
htmlCode = task.execute("http://it-cluster.com.ua").get(); | |
} catch (ExecutionException e) { | |
e.printStackTrace(); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
Log.i("HTML CODE", htmlCode); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment