Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A class containing the properties:</p> <pre><code>public class ImageDetails { private String imageDate, imageTitle, imageDesc; // getters and setters here } </code></pre> <p>inside the IOHandler class, inside the startElement function, add this,</p> <pre><code>if(qName.equalsIgnoreCase("channel") { imageDetails = new ImageDetails(); // make sure imageDetails is declared in the class } </code></pre> <p>this line instantiates the imgedetails class when the start tag channel is found, and it would be intantiated just once since the feed has only one item.</p> <p>other changes to be made in the IOHandler class</p> <p>create a function like</p> <pre><code>public ImageDetails getImageDetails() { // call the function that reads the documents or parses it return imageDetails; } </code></pre> <p>Whenever the localnames match use the setter methods to set the values.</p> <p>Create an instance of IOHandler in the activity class</p> <pre><code>IOHandler ioHandler = new IOHandler(pass values if needed); ImageDetails imageDetails = ioHandler.getImageDetails(); </code></pre> <p>use imageDetails.getter methods to fill the textviews with data.</p> <p>======== EDIT #1</p> <p>change the startElement function to this:</p> <pre><code> @Override public void startElement(String uri, String localName, String qName, org.xml.sax.Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); if (qName.equals("enclosure")) { System.out.println(new String("characters Image")); //imageUrl = attributes.putValue("","url"); // I have commented out this line, try to figure out how to get this atleast System.out.println(imageUrl); inUrl = true; } else { inUrl = false; } if (qName.startsWith("item")) { inItem = true; } else if (inItem) { if (qName.equals("title")) { inTitle = true; } else { inTitle = false; } if (qName.equals("description")) { inDescription = true; } else { inDescription = false; } if (qName.equals("pubDate")) { inDate = true; } else { inDate = false; } } } } </code></pre> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload