This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asyncMethodCaller.callMethod(MainActivity.this, 1001).execute(new TaskCallback<BaseRestOutput>() { | |
@Override | |
public void onResult(BaseRestOutput baseRestOutput) { | |
Handler handler = new Handler(Looper.getMainLooper()); | |
handler.post(new Runnable() { | |
@Override | |
public void run() { | |
methodCallResult.setText("Non param method finish"); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AsyncMethod(id = 1001) | |
public void nonParametricMethod() { | |
for (int i = 0; i < 10; i++) { | |
Log.d("TAG", "do some work"); | |
try { | |
Thread.sleep(200); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends BaseThreadActivity { | |
private AsyncMethodCaller asyncMethodCaller; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
asyncMethodCaller = AsyncMethodCaller.of(this, getCachedThreadPool() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
mCachedThreadPool.openNewPool(this); | |
} | |
@Override | |
protected void onDestroy() { | |
super.onDestroy(); |