Reputation: 11
How can I load a URL without using WebView because my class has not a visual display it's just .java file and dont have .xml file in res/layout folder
I just want to load URL, not displaying or something. I will use it for sending information like that.
private void sendRegistrationToServer(String token) {
//Code here
//Load("mywebsite.com/register.php?token="+token)
}
I tried searching but found nothing to solve this issue.
Thank u :)
Upvotes: 0
Views: 1886
Reputation: 1657
You can use HttpURLConnection
URL url = new URL("http://example.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
Upvotes: 2