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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -