I want to write some values on XML file to save application configuration.
I have to use method?
Thanks in advance.
Virtue.








instrem=Resources.getSystem().openRawResource(R.raw.questions);
try {
TextView tx1=new TextView(this);
TextView tvx=new TextView(this);
XmlResourceParser xpp=Resources.getSystem().getXml(R.xml.myxml);
int eventType=xpp.getEventType();
eventType=xpp.nextTag();
while(eventType!=XmlResourceParser.END_DOCUMENT)
{
if(xpp.getName().equals("name"))
{
tx1.setText("YES!");
}
else { tx1.setText("NO!"); }
eventType=xpp.nextTag();
}
this.setContentView(tx1);
}catch (Exception e) {
// TODO Auto-generated catch block
tvx.setText("Error: " + e.getMessage( ));
Log.e(MY_DEBUG_TAG, "WeatherQueryError", e);
this.setContentView(tvx);
}public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f050001;
public static final int hello=0x7f050000;
}
public static final class xml {
public static final int myxml=0x7f040000;
}
}<?xml version="1.0" encoding="utf-8" ?>
<Person>
<name>Bill</name>
<last>Gates</last>
</Person>

XmlResourceParser xpp=Resources.getSystem().getXml(R.xml.myxml); openRawResource(int id) from the Resource class Resources.getSystem()


Users browsing this forum: No registered users and 4 guests