Reputation: 1449
I have module where I need to list all the data in the recyclerview, I already create this recyclerview on my project however I got error it says that Change 2nd parameter of method player choices from String to String[]. So I already change what the error says. right now still got error incompatible types: String[] cannot be converted to String
Here is the array that I want to list on my recyclerview:
String[] chicken_choice_status = {"Test", "Test2", "Test", "Test2", "Test", "Test2"};
Recyclerview Adapter:
player_choices[] player_choices = new player_choices[] {
new player_choices("1",chicken_choice_status,3,4,5)
};
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
PlayerChoiceAdapter adapter = new PlayerChoiceAdapter(player_choices);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this.getContext()));
recyclerView.setAdapter(adapter);
Here is the error:
After updating the class of
private String[] bet_ratio;
String[] bet_ratio
public String[] get_bet_ratio() {
return bet_ratio;
}
public void setBetRation(String[] bet_ratio) {
this.bet_ratio = bet_ratio;
}
I'am now getting error of
Hope someone help me for this. Thanks
Upvotes: 0
Views: 332
Reputation: 2778
The type of the bet_ratio
field should be changed from String
to String[]
--
String[] bet_ratio;
Upvotes: 0
Reputation: 13579
Check the player_choices
class to determine the type of the bet_ratio
field. It should be defined as:
String[] bet_ratio;
Upvotes: 1