我試圖通過(guò)設(shè)置的值在 android 中setOnGroupClickListener禁用。ExpandableListViewasynctask expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView expandableListView, View view, int i, long l) { try { new checkProgressValue().execute(i).get(3000,TimeUnit.MILLISECONDS); } catch (Exception e) { e.printStackTrace(); } Log.i("ResultPermission", String.valueOf(permission)); if (permission.equals(false)) { return false; } else { eturn true; } } });異步任務(wù)代碼:public class checkProgressValue extends AsyncTask<Integer, Void, Void> { @Override protected Void doInBackground(Integer... voids) { Call<DefaultResponse> call = RetrofitClient.getInstance().getApi() .checkQuizTopicForAttempt(user.getId(), topicList.get(voids[0]).getCourse_id()); final int temp = voids[0]; call.enqueue(new Callback<DefaultResponse>() { @Override public void onResponse(Call<DefaultResponse> call, Response<DefaultResponse> response) { try { if (response.body().getMessage() == null) { progressValue = 0; } 程序不會(huì)在execute(i).get()方法處等待,并且始終返回 true。該方法中的Log.i打印權(quán)限為true,而打印權(quán)限為AsyncTaskfalse。我沒(méi)明白我錯(cuò)在哪里。或者我有什么方法可以處理onClick嗎PostExecute?
1 回答

慕桂英546537
TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超10個(gè)贊
只需在以下位置調(diào)用此函數(shù)onResponse
:
expandableListView.expandGroup(positionOfGroup);
添加回答
舉報(bào)
0/150
提交
取消