Code example for ThreadPoolExecutor

Methods: submit

0
            mHandler.post(new DisplayItemRunnable<Params, Result>(this, request, true));
 
            return; 
        } 
 
        request.loadItemTask = mExecutorService.submit(new LoadItemRunnable<Params, Result>(this, request));
    } 
 
    void performLoadItem(View itemContainer, View itemView, Adapter adapter, int position, boolean shouldDisplayItem) {
        // Loader returned no parameters for the item, just bail 
        final Params itemParams = getItemParams(adapter, position);
        if (itemParams == null) {
            return; 
        } 
 
        final ItemState<Params> itemState = getItemState(itemView);
        itemState.itemParams = itemParams;
        itemState.position = position;
 
        // Mark the view for loading 
        itemState.shouldLoadItem = true;