Simple code for parsing activity_main.xml
XmlResourceParser xmlResourceParser = res.getXml(R.layout.activity_main);
Android Studio finds error "Expected resource of type xml", but runs this code and app works correct.
Simple code for parsing activity_main.xml
XmlResourceParser xmlResourceParser = res.getXml(R.layout.activity_main);
Android Studio finds error "Expected resource of type xml", but runs this code and app works correct.
Android Studio uses an inspector to help you find an error, it expects a resource type 'R.xml.nameresource', obviously works because steps still an xml. For delete error you can disable inspection 'Constant and Resource Type Mismatches' options or add a xml folder in your res folder, create a new xml file and copy your content
The resource type of that resource is technically not xml
, instead it is actually layout
. I think it must still be working because layout files are also XML files.