Hello,

I need create some EditText dynamically in my application, but these
components have to apply one custom style in styles.xml.

I am trying to this next way:

XmlResourceParser parser = getResources().getXml(R.style.MyStyle);
AttributeSet attributes = Xml.asAttributeSet(parser);
...
for (SomeObject obj : ObjArray) {
  EditText edit = new EditText(this, attributes);
  edit.addTextChangedListener(new CustomTextWatcher(obj));
  parentObj.addView(edit);
}

but while executing it fails with exception

android.content.res.Resources$NotFoundException: Resource ID
#0x7f050001
at android.content.res.Resources.getValue(Resources.java:846)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:
1796)
at android.content.res.Resources.getXml(Resources.java:734)

Can somebody tell me - how to do this feature?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to