0

I have a file in R.xml.test that looks like this

<?xml version="1.0" encoding="utf-8"?>
<resources>
<scale factor="1.00" />    
</resources>

What is the proper way to fetch the scale factor attribute?

I am thinking something like:

InputStream inputStream = resources.getAssets().open("test.xml");        
 XmlPullParserFactory xmlPullParserFactory = XmlPullParserFactory.newInstance();             xmlPullParserFactory.setNamespaceAware(true); 
xmlResourceParser = xmlPullParserFactory.newPullParser(); xmlResourceParser.setInput(inputStream, "UTF-8");'
Michael Kern
  • 639
  • 8
  • 15

1 Answers1

1

Refs How I get Attribute using by XMLPull parser

//loop parser until you get Tag scale 
parser.getAttributeValue(null, "factor") 
Community
  • 1
  • 1
Yong
  • 1,107
  • 1
  • 12
  • 21