'How can I open an url link without opening a browser (Android Studio)?

I need some help for opening an URL link, yeah I know...

I use this link to start recording on my GoPro HERO 5. But for some reasons I tried multiple ways of doing it.

1st method :

URL _url = new URL("http://10.5.5.9/gp/gpControl/command/shutter?p=1");
URLConnection _urlConnection = _url.Openconnection;
_urlConnection.connect();

2nd method :

_url = new URL("http://10.5.5.9/gp/gpControl/command/shutter?p=1");
_http = (HttpURLConnection) _url.openConnection();
_http.connect()

3rd method :

DatagramSocket _mySocket = new DatagramSocket();
InetAddress _myAdr = InetAddress.getByName("http://10.5.5.9/gp/gpControl/command/shutter?p=1");
DatagramPacket _myPacket = new DatagramPacket(buf, buf.length, _myAdr);

_mySocket.receive(_myPacket);

4th method :

WebView.LoadUrl("http://10.5.5.9/gp/gpControl/command/shutter?p=1");

the 4th way kind of worked but it opened a browser window which I don't want to.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source