get Child Text from XML Node - Android XML

Android examples for XML:XML Node

Description

get Child Text from XML Node

Demo Code



public class Main{
    /* w w  w . j a  va  2s. c om*/
    public static String getChildText(Node node, String childNodeName) {
        Node child = node.getFirstChildrenByName(childNodeName);
        if (child != null) {
            return child.getText();
        } else {
            return null;
        }
    }
}

Related Tutorials