0

I have an ArrayList in a first activity ArrayList<ListeJoueurs> la = new ArrayList<>();, defined as follows. I would like to put this ArrayList into another activity. I didn’t find a simple solution with getIntent() What can I do, thank you so much for your help.

    public class ListeJoueurs {
    String  Nom;
    String  Prenom;
    Long  Licence;
    String  Cat;
    String Select;
    String dteN;
    int imageClick;
    // Constructor
    public ListeJoueurs(String Nom, String Prenom, Long Licence, String Cat, String Select, String dteN, int imageClick)
    {
        this.Nom = Nom;
        this.Prenom = Prenom;
        this.Licence = Licence;
        this.Cat = Cat;
        this.Select = Select;
        this.dteN = dteN;
        this.imageClick = imageClick;
    }

    // Used to print student details in main()
    public String toString()
    {
        return  this.Nom  + " " + this.Prenom + " " + this.Licence + " " + this.Cat + " " + this.Select + " " + this.dteN  + " " + this.imageClick;
    }
}

1 Answers1

0

you can use the Gson library to transfer data between Activities. You can convert a list of data to JSON and pass it. These links Can help you.

https://stackoverflow.com/a/19700319/12980812

https://medium.com/@theblackcat102/passing-object-between-activity-using-gson-7dfa11d74e06

Mahdi Noori
  • 11
  • 1
  • 6