Java 可完成的未来是否中断或buttonView是否有某种超时

Java 可完成的未来是否中断或buttonView是否有某种超时,java,android,android-recyclerview,completable-future,ui-thread,Java,Android,Android Recyclerview,Completable Future,Ui Thread,我正在使用CF获取练习列表。当用户单击按钮时,文本变为灰色,按钮不再可单击: 因此按钮变为灰色,但设置已启用(false)调用会导致问题 当设置启用时(假)行将被执行调试器只是停止,程序继续运行,就好像线程被中断,控制权被交还给主线程(或UI线程),当我单击离开并返回时,然后返回setEnabled(false)也被执行,按钮不再可单击,按钮在执行单击后也不可单击,但视图只是没有更新以便可见,所以为什么“setTextColor(Color.GRAY);”不会出现任何问题,但setEnable

我正在使用CF获取练习列表。当用户单击按钮时,文本变为灰色,按钮不再可单击:

因此按钮变为灰色,但
设置已启用(false)调用会导致问题
当
设置启用时(假)行将被执行调试器只是停止,程序继续运行,就好像线程被中断,控制权被交还给主线程(或UI线程),当我单击离开并返回时,然后返回
setEnabled(false)也被执行,按钮不再可单击,按钮在执行单击后也不可单击,但视图只是没有更新以便可见,所以为什么“setTextColor(Color.GRAY);”不会出现任何问题,但setEnabled会出现问题

这是CF电话

client.userReacted(exercises.get(position),reaction,mainActivityReference.userReactionsListLocal, mainActivityReference.reactionsThread)
                    .thenAcceptAsync((reactionMap)->{
                        if (reactionMap!=null){
                            mainActivityReference.userReactionsListLocal=reactionMap;
                            setColorsAndCounterAfterReaction(mainActivityReference.userReactionsListLocal, position, holder);
                            CompletableFuture.runAsync(()->{LoggedInUserHolder.updateOrSaveReactionListLocally(mainActivityReference.userReactionsListLocal);});
                        }
                        else
                            Helpers.msgToDisplayAsSnackbar(mainActivityReference.findViewById(android.R.id.content),
                                    "Es tut uns leid, aber aufgrund Verbindungsproblemen ist die Abgabe einer Reaktion nicht möglich",3000,7,Gravity.TOP);
                    }, mainActivityReference.reactionsThread);
内部
setcolors和counterafterreaction
方法是发生更改的地方:

if(reaction.contains(REACT_FAVORITE_KEY)){
                holder.to_favorite.setTextColor(Color.GRAY);
                holder.to_favorite.setEnabled(false);-> the buttonView is not updated, have to exit the view and come back to see the change
            }
解决了这个问题,希望有一天能帮上忙

activityInstance.runOnUiThread(()->{setColorsAndCounterAfterReaction(mainActivityReference.userReactionsListLocal, position, holder);});