Code example for Node

Methods: getAttributes, getChildNodes, toString

0
	private static final String TAG = "amlcode";
 
	private CheckBox view;
 
	public AmlInputCheckBox(Context context, Node n) {
		Log.d(TAG, "New CheckBox input from XML node " + n.toString());
		LayoutInflater mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		view = (CheckBox) mInflater.inflate(AmlBuilder.localResources.getInt("aml_input_checkbox"), null);
		Node label = n.getChildNodes().item(0);
		Node checkedNode = n.getAttributes().getNamedItem("checked");
		if (label != null) view.setText(label.getNodeValue());
		String checked = "";
		if (checkedNode != null) checked = checkedNode.getNodeValue().toLowerCase();
		view.setChecked(checked.equals("yes"));
		AmlBuilder.applyActionAttribute(view, "tap", n.getAttributes().getNamedItem("tap"));
		Log.d(TAG, "New CheckBox input construction complete from XML node " + n.toString());
	} 
 
	/** 
	 * Get the View created from this object 
	 * @return View to be inserted into parent layout