Android studio res/xml directory not found -


I need to include a searchable configuration file in my project, in the Android documentation they have said that this xml file Res / xml is included in the directory. But the XML directory is not found. Do I need to create an XML directory or add this XML file elsewhere?

  import android.app.activity; Importroid.os.Bundle; Import android.util.log; Import android.view.View; Import android.widget.TextView; Public class increases main activity {Private static string; APP_TAG = "tag"; See private text view lessons; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.main); TextView = (TextView) findViewById (R.id.textField); findViewById (R.id.readBtn) .setOnClickListener (New View.OnClickListener () {@Override public void onClick (View v) {XmlPullParser parser = getResources () getXml (R.xml.cars) ;. StringBuilder stringbuilder = new StringBuilder ( ); try {while (parser.next () = XmlPullParser.END_DOCUMENT) {string name = parser.getName! (); string status = null; string brand = null; if ((name = null!) & amp; & amp ; name .equals ( "cars")) {int size = parser.getAttributeCount (); (int i = 0; i & LT; size; i ++) {string attrName = parser.getAttributeName (i); string AttrValue = parser.getAttributeValue (I); if ((attrName! = Null) & attrName.equals ("position")) {status = attal ;} And if ((attrName! = Null) & amp; attrName.equals ("brand") {brand = attrValue;}} if ((position! = Null) & amp; (brand! = Null) {StringBuilderkappend (position + "," + brand + "\ n");}} TextView.setText (stringBuilder.toString ());}} catch (exception e) {log. A (Apiteepiaji, EA M. Messages ());}}}); }} ---------- You need to create XML directory under the XML directory in the XML folder (RAS-XML), in the XML folder you have inserted Car.xml, I have XML / car.xml Sample code is added to get data  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Algorithm negotiation fail SSH in Jenkins -

java - Messages from .properties file do not display UTF-8 characters -