When I have a method like this:
public XmlParser() throws XmlPullParserException, IOException
{
...do some stuff...
}
How do I call that method?
I tried doing this:
XmlParser xmlparse = new XmlParser();
but I get an Unhandled exception type IOException error.
Thanks
Since the constructor for
XmlParserdeclares that itthrows XmlPullParserException, IOException, then you need to do one of the following things in your code.Your first option is to catch those Exceptions directly in your code:
Alternately, you could declare whichever method you’re including this code in such that it also
throws XmlPullParserException, IOException.Finally, you could catch one of the exceptions and pass the other one on. Let’s assume that you’re writing
myMethod: