i'm practicing creating apps and i have a problem that i don't understand : why i'm getting this error with this code :
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.baziremartin.pyramideapp.paquet.getCartes(int)' on a null object reference
the code :
 mTestBTN.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                List<joueur> currentPlayers = new ArrayList<>();
                for(int i = 0; i < allPlayers.size(); i ++){
                    currentPlayers.add(new joueur(allPlayers.get(i)));
                    currentPlayers.get(i).setHand(paquet1.getCartes(4));
                }
            }
        });
I've already search and i think it is a reference syntaxe error but i don't understand whats is the good syntax.. (i have try a lot of differents things). Thanks for help i'm beginner in java.
