@Override public boolean show(Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); final List<ChatOption> options = ChatSDK.ui().getChatOptions(); String [] items = new String [options.size()]; int i = 0; for(ChatOption option : options) { items[i++] = option.getTitle(); } hasExecuted = false; builder.setTitle(context.getString(R.string.actions)).setItems(items, (dialogInterface, i1) -> { if(!hasExecuted) { executeOption(options.get(i1)); } hasExecuted = true; }); dialog = builder.show(); return true; }