Skip to content

Instantly share code, notes, and snippets.

View cagdasc's full-sized avatar
🎯
Focusing

Cagdas Caglak cagdasc

🎯
Focusing
View GitHub Profile
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");
}
});
@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();
}
}
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()
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCachedThreadPool.openNewPool(this);
}
@Override
protected void onDestroy() {
super.onDestroy();