@Override
        public void onClick(DialogInterface dialog, int which) {
            // User clicked OK button
            int[] inputs = new int[playerManager.getSelectedPlayerCount()];
            //starts at STARTINGPLAYER, since input list starts at STARTINGPLAYER
            for (int i = STARTINGPLAYER; i < playerManager.getSelectedPlayerCount() + STARTINGPLAYER; i++) {
                int index = getPlayerIndex(i);
                EditText editText = (EditText) ((LinearLayout) linearLayout.getChildAt(i - STARTINGPLAYER)).getChildAt(3);
                //verify input
                int input;
                try {
                    input = Integer.parseInt(editText.getText().toString());
                } catch (NumberFormatException nfe) {
                    Toast toast = Toast.makeText(CONTEXT, "Invalid input", Toast.LENGTH_SHORT);
                    toast.show();
                    return;
                }
                inputs[index] = input;
            }
            //validate results
            int totalValue = 0;
            for (int value : inputs) {
                if (value < 0) {
                    Toast toast = Toast.makeText(CONTEXT, CONTEXT.getResources().getString(R.string.invalid_number), Toast.LENGTH_SHORT);
                    toast.show();
                    return;
                }
                totalValue += value;
            }
            if (gameScoreManager.getNextEntryType() == ReadOnlyGameScoreManager.EntryType.SCORE && totalValue != gameScoreManager.getCardCount(gameScoreManager.getRound())) {
                Toast toast = Toast.makeText(CONTEXT, CONTEXT.getResources().getString(R.string.invalid_score), Toast.LENGTH_LONG);
                toast.show();
                return;
            }
            //save results
            //todo: save playerID with input field for better code quality
            Map<Long, Integer> inputMap = new HashMap<>();
            for (int i = 0; i < playerManager.getSelectedPlayerCount(); i++) {
                inputMap.put(playerManager.getSelectedPlayers()[i], inputs[i]);
            }
            //if this entry is score, update views && activate next round
            if (gameScoreManager.getNextEntryType() == GameScoreManager.EntryType.SCORE) {
                gameScoreManager.enterScores(inputMap);
                PersistenceManager.getInstance().saveGame(gameScoreManager);
                headerManager.updateScores();
                rowManager.updateScores();
                changeButtonVisibility(ButtonVisible.NONE);
                if (gameScoreManager.getRound() != gameScoreManager.getAmountOfRounds()) {
                    nextRound.changeButtonVisibility(ButtonVisible.PREDICT);
                }
            } else {
                gameScoreManager.enterPredictions(inputMap);
                PersistenceManager.getInstance().saveGame(gameScoreManager);
                rowManager.updatePredictions();
                changeButtonVisibility(ButtonVisible.SCORE);
            }
            //change buttons
            changeButtonVisibility(gameScoreManager.getNextEntryType() == ReadOnlyGameScoreManager.EntryType.SCORE ? ButtonVisible.SCORE : ButtonVisible.NONE);
        }
@Override
        public void onClick(DialogInterface dialog, int which) {
           
            int[] inputs = new int[playerManager.getSelectedPlayerCount()];
           
            for (int i = STARTINGPLAYER; i < playerManager.getSelectedPlayerCount() + STARTINGPLAYER; i++) {
                int index = getPlayerIndex(i);
                EditText editText = (EditText) ((LinearLayout) linearLayout.getChildAt(i - STARTINGPLAYER)).getChildAt(3);
               
                int input;
                try {
                    input = Integer.parseInt(editText.getText().toString());
                } catch (NumberFormatException nfe) {
                    Toast toast = Toast.makeText(CONTEXT, "Invalid input", Toast.LENGTH_SHORT);
                    toast.show();
                    return;
                }
                inputs[index] = input;
            }
           
            int totalValue = 0;
            for (int value : inputs) {
                if (value < 0) {
                    Toast toast = Toast.makeText(CONTEXT, CONTEXT.getResources().getString(R.string.invalid_number), Toast.LENGTH_SHORT);
                    toast.show();
                    return;
                }
                totalValue += value;
            }
            if (gameScoreManager.getNextEntryType() == ReadOnlyGameScoreManager.EntryType.SCORE && totalValue != gameScoreManager.getCardCount(gameScoreManager.getRound())) {
                Toast toast = Toast.makeText(CONTEXT, CONTEXT.getResources().getString(R.string.invalid_score), Toast.LENGTH_LONG);
                toast.show();
                return;
            }
           
           
            Map<Long, Integer> inputMap = new HashMap<>();
            for (int i = 0; i < playerManager.getSelectedPlayerCount(); i++) {
                inputMap.put(playerManager.getSelectedPlayers()[i], inputs[i]);
            }
           
            if (gameScoreManager.getNextEntryType() == GameScoreManager.EntryType.SCORE) {
                gameScoreManager.enterScores(inputMap);
                PersistenceManager.getInstance().saveGame(gameScoreManager);
                headerManager.updateScores();
                rowManager.updateScores();
                changeButtonVisibility(ButtonVisible.NONE);
                if (gameScoreManager.getRound() != gameScoreManager.getAmountOfRounds()) {
                    nextRound.changeButtonVisibility(ButtonVisible.PREDICT);
                }
            } else {
                gameScoreManager.enterPredictions(inputMap);
                PersistenceManager.getInstance().saveGame(gameScoreManager);
                rowManager.updatePredictions();
                changeButtonVisibility(ButtonVisible.SCORE);
            }
           
            changeButtonVisibility(gameScoreManager.getNextEntryType() == ReadOnlyGameScoreManager.EntryType.SCORE ? ButtonVisible.SCORE : ButtonVisible.NONE);
        }
@override public void onclick(dialoginterface dialog, int which) { int[] inputs = new int[playermanager.getselectedplayercount()]; for (int i = startingplayer; i < playermanager.getselectedplayercount() + startingplayer; i++) { int index = getplayerindex(i); edittext edittext = (edittext) ((linearlayout) linearlayout.getchildat(i - startingplayer)).getchildat(3); int input; try { input = integer.parseint(edittext.gettext().tostring()); } catch (numberformatexception nfe) { toast toast = toast.maketext(context, "invalid input", toast.length_short); toast.show(); return; } inputs[index] = input; } int totalvalue = 0; for (int value : inputs) { if (value < 0) { toast toast = toast.maketext(context, context.getresources().getstring(r.string.invalid_number), toast.length_short); toast.show(); return; } totalvalue += value; } if (gamescoremanager.getnextentrytype() == readonlygamescoremanager.entrytype.score && totalvalue != gamescoremanager.getcardcount(gamescoremanager.getround())) { toast toast = toast.maketext(context, context.getresources().getstring(r.string.invalid_score), toast.length_long); toast.show(); return; } map<long, integer> inputmap = new hashmap<>(); for (int i = 0; i < playermanager.getselectedplayercount(); i++) { inputmap.put(playermanager.getselectedplayers()[i], inputs[i]); } if (gamescoremanager.getnextentrytype() == gamescoremanager.entrytype.score) { gamescoremanager.enterscores(inputmap); persistencemanager.getinstance().savegame(gamescoremanager); headermanager.updatescores(); rowmanager.updatescores(); changebuttonvisibility(buttonvisible.none); if (gamescoremanager.getround() != gamescoremanager.getamountofrounds()) { nextround.changebuttonvisibility(buttonvisible.predict); } } else { gamescoremanager.enterpredictions(inputmap); persistencemanager.getinstance().savegame(gamescoremanager); rowmanager.updatepredictions(); changebuttonvisibility(buttonvisible.score); } changebuttonvisibility(gamescoremanager.getnextentrytype() == readonlygamescoremanager.entrytype.score ? buttonvisible.score : buttonvisible.none); }