I want to load Keyboard object from external xml file.
Here is my test code.
Keyboard keyboard = new Keyboard(context, resId);
XmlResourceParser parser = null;
// test code
try {
parser = getAssets().openXmlResourceParser("test.xml");
} catch (IOException e1) {
e1.printStackTrace();
}
try {
Method method =
Keyboard.class.getDeclaredMethod("loadKeyboard",
new Class[] {
Context.class, XmlResourceParser.class
});
method.setAccessible(true);
method.invoke((Keyboard)keyboard, new Object[]
{context, parser});
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (NotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return keyboard;
But getAssets().openXmlResourceParser method does return null.
Because XmlResourceParser can only get internal resource xml as
compiled xml.
How can I get Keyboard object from external xml?
Is there any good idea?
Please help me....
--
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