XmlPullParserFactory ppf = new XmlPullParserFactory.newInstance();
should be
XmlPullParserFactory ppf = XmlPullParserFactory.newInstance();
You must use new
to invoke constructors, not static methods.
Pergunta
I'm trying to parse XML document using XmlPullParser
but I've the following error
Gradle: error: cannot find symbol class newInstance
Creating XmlPullParserFactory
XmlPullParserFactory ppf = new XmlPullParserFactory.newInstance();
How to configure Gradle
to discover XmlPullParser
properly?
Solução
XmlPullParserFactory ppf = new XmlPullParserFactory.newInstance();
should be
XmlPullParserFactory ppf = XmlPullParserFactory.newInstance();
You must use new
to invoke constructors, not static methods.
Outras dicas
You just have to remove the new
keyword from your statement that's all.
Because new
is basically used to create object via calling the constructor of the your class and in this case we are creating a new instance of PullParserFactory
using newInstance()
method and we are calling this method so we do not need to use this.
And The factory will always return instances of KXmlParser
and KXmlSerializer
.