http - Android - Open URL in background -
there website example http://website.com can stuff there, link example: http://website.com/3020/hype. have go link article (3020) liked. can stuff when loged in.
i have this:
httpclient client = new defaulthttpclient(); string geturl = "http://website.com/3020/hype/"; httpget = new httpget(geturl); httpresponse responseget = client.execute(get, cookiestuff);
where cookiestuff cookie string got loggin in.
this works, takes ages. there option?
yes there nother option.. internet connections , database connection should made in aynctask or handler.. improve time taken connection (the connections make in background)..
here example async task:
private class yourtask extends asynctask<string, void, string> { @override protected string doinbackground(string... s) { //here have make loading / parsing tasks //don't call ui actions here. example toast.show() couse exceptions // ui stuff have make in onpostexecute method } @override protected void onpreexecute() { // method called during doinbackground in process // here can example show progressdialog } @override protected void onpostexecute(long result) { // onpostexecute called when doinbackground finished // here can example fill listview content loaded in doinbackground method }
}
to execute asynctask:
new yourtask().execute("");
Comments
Post a Comment