I need to dynamically create a stylized button. I thought maybe I should do it like this:
XmlPullParser parser = m_context.getResources().getXml(R.style.Button_Plain);
buttonStyle = Xml.asAttributeSet(parser);
Button btn = new Button (m_context, buttonStyle);
But it getXmlthrows an exception "The resource request did not work because it is complex." Is there an easy way to do what I need?
source
share