networking - how to handle the network requst in android -
i want draw requested online,then core implement(draw logic ommitted):
public abstract class abstractbasicdatahandler extends abstracthandler{ private dataprovider tp = new dataprovider(); @override protected void onreadytodraw(canvas c,int params) { byte[] data = tp.getdrawabledata(params); dorender(c, data); } protected abstract void dorender(canvas c, byte[] data); }
the abstractbasicdatahandler
job of data requesting,then sub class of abstractbasicdatahandler
focus on rendering work this:
public class anyclass extends abstractbasicdatahandler{ @override dorender(canvas c, byte[] data){ //render according data } }
however question data requesting time-consumed work means data may noe returned immedirately.
so experience meet kind of requirements?
yes can use asynctask
perform network operation in doinbackground()
, perform ui operation in postexecute()
.
Comments
Post a Comment