Android Element - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Element class.

This code example shows how to use the following methods:getChild, setEndElementListener
        final Tea curTea = new Tea();
        RootElement root = new RootElement(ROOT_ELEMENT);
        final List<Tea> teas = new ArrayList<Tea>();
 
        Element tea = root.getChild(TEA);
        tea.setEndElementListener(new EndElementListener(){
            public void end() { 
                teas.add(curTea.copy());
            } 
        }); 
        tea.getChild(NAME).setEndTextElementListener(new EndTextElementListener(){
            public void end(String body) {
                curTea.setName(body);
            } 
        }); 
        tea.getChild(GROUP).setEndTextElementListener(new EndTextElementListener(){
            public void end(String body) {
                curTea.setGroup(body);
            } 
        }); 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChild, setEndTextElementListener
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChild, getContentHandler
	public List<Ad> parse() {
		final Ad currentAd = new Ad();
		final List<Ad> ads = new ArrayList<Ad>();
		final String labelValue[] = new String[2];
		 
		RootElement root = new RootElement("AdsResult");
 
		Element adElements = root.getChild("ads");
		Element adElement = adElements.getChild("ad");
		adElement.setEndElementListener(new EndElementListener() {
			public void end() { 
				ads.add(currentAd.copy());
			} 
		}); 
		Element adId = adElement.getChild("ad-external-reference-id");
		adId.setEndTextElementListener(new EndTextElementListener() {
			public void end(String body) {
				currentAd.setAdId(body);
			} 
		}); 

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChild, setEndElementListener
		final List<UserBean> ulist = new ArrayList<UserBean>();
		final UserBean currentUser = new UserBean();
		 
		RootElement root = new RootElement("result");
		Element item = root.getChild("user");
		item.getChild("name").setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentUser.setName(body);
					} 
				}); 
		item.getChild("phone").setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentUser.setPhone(body);
					} 
				}); 
		item.setEndElementListener(new EndElementListener() {
			public void end() { 
				ulist.add(currentUser.copy());

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChild, getContentHandler
	} 
 
	@Override 
	public Object parseXml(String xmlString) throws Exception {
		Log.d(TAG, "xmlString: "+xmlString);
		RootElement rootElement = new RootElement("searchresults");
		Element placeElement = rootElement.getChild("place");
		placeElement.setStartElementListener(new StartElementListener() {
 
			@Override 
			public void start(Attributes attributes) {
				HashMap<String, Double> map = new HashMap<String, Double>();
				map.put("lat", Double.parseDouble(attributes.getValue("lat")));
				map.put("lon", Double.parseDouble(attributes.getValue("lon")));
				points.add(map);
			} 
		}); 
 
		Xml.parse(xmlString, rootElement.getContentHandler());
		Log.d(TAG, points.toString());

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChild, getContentHandler
	public RSSGallery(ViewCentral hub, EventBridge eventExchange) {
		 
		super(); 
		m_hub = hub;
		 
		RootElement root = new RootElement("sources");
		Element elem = root.getChild("source");
		elem.setEndElementListener(this);
	 
		m_handler = root.getContentHandler();
		m_template = new RSSSource(elem);
		m_eventExchange = eventExchange;
	} 
	 
    public View getView(int position, View convertView, ViewGroup parent) {
    	 
    	// todo; ändra cast  
    	 
    	RSSSource source = (RSSSource)getItem(position);
    	ImageView i = new ImageView(m_hub);
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChild, getContentHandler
		try { 
		 
			URL metaURL = getURL();
			InputStream in = metaURL.openStream();
		 
			RootElement root = new RootElement("rss");
			Element elem = root.getChild("channel");
			elem = elem.getChild("image");
		 
			registerAttributeListener(elem, "url", ATR_IMAGE);
			registerAttributeListener(elem, "width", "image_width");
			registerAttributeListener(elem, "height", "image_height");
			 
			Xml.parse(in, Xml.Encoding.UTF_8, root.getContentHandler());
			 
			m_noMeta = false;
		 
		} catch(Exception e) {
			throw new LoggedException(e);
		} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChild, getContentHandler
	protected void addFileToCall(String key, String fileName) {
		multipartEntity.addPart(key, new FileBody(new File(fileName)));
	} 
	 
	protected void makeCall(RootElement root) {
		Element errorTag = root.getChild("error");
		errorTag.setStartElementListener(new StartElementListener(){
				public void start(Attributes attributes) {
					errorCode = attributes.getValue("code");
				} 
	        }); 
		errorTag.setEndTextElementListener(new EndTextElementListener(){
			public void end(String body) {
				errorMessage = body;
			} 
		});  
 
		try { 
			httppost.setEntity(multipartEntity);
			response = httpclient.execute(httppost);

4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChild
	} 
 
	private void GetXmlProperty(RootElement root, final String tag,
			final Map<String, String> myInfo) {
		// 取name_cn属性 
		Element elementNameCN = root.getChild(tag);
		elementNameCN.setEndTextElementListener(new EndTextElementListener() {
			@Override 
			public void end(String body) {
				myInfo.put(tag, body);
			} 
		}); 
	} 
 
	// 得到有效的模板名列表 
	private void GetValidTemplateFiles() { 
		try { 
			String strXmlFile, strExt, strBaseFile;
			boolean bOK;
			String[] arrAllList = mAssManager.list("");
3
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android Element Questions & Answers:

See Code Examples for Android Element Methods: