HttpResponse

by Mr.No » Mon, 02 Mar 2009 23:31:14 GMT


Sponsored Links
 Hello,
where i find the Content(message body) of a HttpResponse?
rgds Mr.No
--~--~---------~--~----~------------~-------~--~----~



HttpResponse

by Streets Of Boston » Sat, 07 Mar 2009 00:43:14 GMT


 If i remember correctly, try httpResponse.getEntity() and go from
there.



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Sqlite busy timeout - [was error code 5: database is locked]

I'm definitely not turning it off.
I'll try explicitly enabling locking as see if it make a difference.

But I'd like to know what busy timeout is being used for Android.
I would hope my app is not falling foul of it.
But I have one (very simple) query what regularly takes about 2
seconds to execute.

















-- 

2. startElement not called in SAX Parser

Hoi,

I'am building a RSS reader based on newsdroid and androidRSS.
(newsdroid: http://www.helloandroid.com/tutorials/newsdroid-rss-reader)
(androidRSS: 
http://www.ibm.com/developerworks/xml/tutorials/x-androidrss/index.html)

Up til now, i'am able to read a RSS-file and parse it. Although,
during parising, the parser never calls the startElement procedure !
Useless to say that this is a great problem for me ! Log-files during
processing shows parsing uses startDocument, endElement and Characters
without any problem. It just never reach startElement.

Anyone got a clue ?


This is my code:

##############
class RSSReader
##############

        .... / ...

        RSSHandler rh = new RSSHandler();
        try {
             rh.updateArticles(this, link);
        } catch (Exception e) {
             Log.i(TAG, e);
        }

        .... / ...


##############
class RSSHandler
##############

        .... / ...

        /** STARTDOCUMENT **/
        public void startDocument() throws SAXException {
                targetFlag = TARGET_FEED;
        }

        /** STARTELEMENT **/
        public void startElement(String uri, String localName, String qName,
Attributes atts) throws
                                           SAXException{
                if(localName.trim().equals("title")) {
                        inTitle = true;
                } else if (localName.trim().equals("item")){
                        targetFlag = TARGET_ARTICLES;
                        inItem = true;
                } else if (localName.trim().equals("description")){
                        inDescription = true;
                } else if (localName.trim().equals("pubDate")){
                        inPubdate = true;
                } else if (localName.trim().equals("link")){
                        inLink = true;
                }
        }

        /** ENDELEMENT **/
        public void endElement(String uri, String name, String qName) throws
SAXException {
                if(name.trim().equals("title")) {
                        inTitle = false;
                } else if (name.trim().equals("item")){
                        targetFlag = TARGET_FEED;
                        inItem = false;
                } else if (name.trim().equals("description")){
                        inDescription = false;
                } else if (name.trim().equals("pubDate")){
                        inPubdate = false;
                } else if (name.trim().equals("link")){
                        inLink = false;
                }
                if (targetFlag == TARGET_ARTICLES) {
                        rssDB.insertItem(feedId, currentArticle.title,
currentArticle.pubdate,
                                         currentArticle.description,
currentArticle.link);
                        currentArticle.feedId = feedId;
                        currentArticle.title = null;
                        currentArticle.pubdate = null;
                        currentArticle.description = null;
                        currentArticle.link = null;
                }
        }

        /** CHARACTERS **/
        public void characters(char ch[], int start, int length) {
                String chars = (new String(ch).substring(start,start+length));
                if(inItem) {
                        if(inTitle)     currentArticle.title = chars;
                        if(inPubdate)   currentArticle.pubdate = chars;
                        if(inDescription)       currentArticle.description = 
chars;
                        if(inLink)      currentArticle.link = chars;
                }
        }

        /** GET ARTICLES **/
        public void updateArticles(Context ctx, String link) throws
MalformedURLException {
                URL url = new 
URL("http://pipes.yahoo.com/hugozalm/a20popularblogs?
_render=rss");
                try {
                        int targetFlag = 1;
                        A20DB db = new A20DB(ctx);
                        SAXParserFactory spf = SAXParserFactory.newInstance();
                        SAXParser sp = spf.newSAXParser();
                        XMLReader xr = sp.getXMLReader();
                        xr.setContentHandler(this);
                        InputSource is = new InputSource(url.openStream());
                        xr.parse(is);
                } catch (IOException e) {
                        Log.e("A20RSS",e.toString());
                } catch (SAXException e) {
                        Log.e("A20RSS",e.toString());
                } catch (ParserConfigurationException e) {
                        Log.e("A20RSS",e.toString());
                }
        }

        .... / ...


-- 

3. Where to learn Android graphics concepts and techniques

4. can't install Android platform 2.2 on windows vista 64 bit computer

5. OpenGL more textures for one rect

6. Share Data with ACTION_SEND

7. How to draw dotted-line