setReadTimeout для URLConnection и Android - PullRequest
0 голосов
/ 26 апреля 2011

У кого-нибудь есть удача заставить setReadTimeout работать в Android? Я пробовал другое решение, и ни одно из них не работает

    URLConnection connection;
    XMLReader xr = sp.getXMLReader();

    /** Send URL to parse XML Tags */
    URL sourceUrl = new URL(urlString);
    connection = (URLConnection)sourceUrl.openConnection();
    connection.setReadTimeout(5000);

    connection.connect();


    /** Create handler to handle XML Tags ( extends DefaultHandler ) */
    MyXMLHandler myXMLHandler = new MyXMLHandler();
    xr.setContentHandler(myXMLHandler);
    xr.parse(new InputSource(connection.getInputStream()));
...