0
public Tasks(int linkToDiolog, int reward, Weapon weapon, int q) {
    this.linkToDiolog = linkToDiolog;
    this.reward = reward;
    this.weapon = weapon;
    this.q = q;
}

I need to put new object in the array list like this:

public Tasks(int linkToDiolog, int reward, Weapon weapon, int q) {
    this.linkToDiolog = linkToDiolog;
    this.reward = reward;
    this.weapon = weapon;
    this.q = q;
    listOfTasks[q] = new Tasks(linkToDiolig, reward, weapon, q);  
}

I know that this will lead to an infinite loop, but I hope you know how the code can be lightened and unloaded in a different way.

1 Answer 1

0

Create another method in Tasks class to create new Tasks object and call it from activity where you created the class object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.