Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the complete URL from URI?

I am trying to get the path or a URL I intercept from my app.

Sample URL: http://myapp.com/foo/bar/145

I am trying to get: /foo/bar/145

Uri data = getIntent().getData();
String path = data.getPath() // gives "/"

How can I get /foo/bar/145?

like image 980
Anthony Avatar asked Sep 06 '25 03:09

Anthony


1 Answers

.toString() method will return complete url as a simple String, if you need URL instance, then you can use new URL(uriPath.toString()).

like image 188
Milton BO Avatar answered Sep 07 '25 21:09

Milton BO