Alp
Alp

Reputation: 11

Loading URL without webview

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

Answers (1)

alex440
alex440

Reputation: 1657

You can use HttpURLConnection

URL url = new URL("http://example.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");

Upvotes: 2

Related Questions