java - Is it possible to perform separate network thread within a same activity without wait? -
i performing 2 class extending asynctask
, both have different functions because of second
class first class lagging. want know is, there better solution code in such way both of operation perform task without making other operation wait?
updated code first call in oncreate()
new connection().execute(); //
some task performed same class called
public class connection extends asynctask { @override protected object doinbackground(object... arg0) { //some operation return value; } @override protected void onpostexecute(object o) { super.onpostexecute(o); string m = string.valueof(o); if (o != null) { someoperation } else { edittxt.settextcolor(color.red); edittxt.settext("no internet connection"); } } }
similarly performing other class have.
you can use asynctask.executeonexecutor
thread_pool_executor
, default executor serial_executor
.
Comments
Post a Comment