android get URL path

Posted by Tom91136 on Stack Overflow See other posts from Stack Overflow or by Tom91136
Published on 2012-09-16T09:31:26Z Indexed on 2012/09/16 9:37 UTC
Read the original article Hit count: 162

Filed under:
|
|

I've got a string:

public://imageifarm/3600.jpg

How can I extract the

imageifarm/3600.jpg

Part out using android?

What I've tried so far:

URL drupalQuestionNodeImageURI = new URL("public://imageifarm/3600.jpg");
Log.d("TAG", drupalQuestionNodeImageURI.getPath());

but it throws this exception:

09-16 17:24:39.992: W/System.err(3763): java.net.MalformedURLException: Unknown protocol: public

How can I solve this?

I know I can use regular expressions but that seems to defeat the purpose of URL(URI) in this case.

© Stack Overflow or respective owner

Related posts about java

Related posts about android