0

in my app i am trying to parse an xml file from a url. My url contains some Strings which values are got from an edit box in another activity. In mu coding i got error in the following line

xmlreader.parse(new InputSource(url.openStream()));

A red line is shown in the word openStream, it says that
"The method openStream() is undefined for the type String"

please tell me how to define a openStream method for a url which is a String

1 Answer 1

1

how to define the method openstream for String url in android

you can't String is final class

You need to use some HTTP client library and download the content from the internet.

You may also use URL class like new URL(url).openStream() but remeber to use it on non UI thread.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.