java - Can't get website using jsoup on Android -


i have problem getting website jsoup on android.

public class parser {     parser()     {         new parser1().execute();     }      class parser1 extends asynctask<void, void, void>     {         string website1 = "http://google.com";         document doc;          @override         protected void onpreexecute()         {             super.onpreexecute();         } 

this code not execute doinbackground method.

        @override         protected void doinbackground(void... params)         {             try             {                 doc = jsoup.connect(website1).get();             }             catch (ioexception e)             {                 e.printstacktrace();             }              return null;         } 

and rest of code.

        @override         protected void onprogressupdate(void... values)         {             super.onprogressupdate(values);         }          @override         protected void onpostexecute(void result)         {             log.d ("ok",doc.tostring());              super.onpostexecute(result);         }          @override         protected void oncancelled()         {             super.oncancelled();         }     } } 

i tried write code without class asynctask, on json.connect program exception. replies.

try this:

@override protected void doinbackground(void... params) {    try {        doc = getdocument(website1);    } catch (exception e) {        e.printstacktrace();    }     return null; } 

click following link full implementation of getdocument.

references


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -