Upgrading to Kotlin I came to the point of a Java Interface I was using to get data out of a Custom Recycler Adapter. Now in Kotlin I do not fully understand how to access the interface now. This is my Java Code I'm trying to get working in my Kotlin App.
btOK is a Button in my XML which collects all the selected Items my user has picked inside a ExpListView (You can find the full code here) and due the interface "SelectedDrink" I'm able to access the data.
Here the Button with the ClickListener:
btOk.setOnClickListener(view -> {
Button button = (Button) view;
msg = "Upload!\n";
ArrayList<SelectedDrink> selectedDrinks = expandableListAdapterDrinks.getOrderList();
Gson gson = new Gson();
for (SelectedDrink selectedDrink : selectedDrinks) {
msg += "aid=" + selectedDrink.content + "+qty=" + selectedDrink.qty + "\n";
}
final String jsonOrder = gson.toJson(selectedDrinks);
sendToServer(jsonOrder,sessionId);
}
});
this is the Interface:
public class SelectedDrink {
String content;
Double qty;
}
Now in Kotlin it gives me an error on these two boys here:
selectedDrink.content
selectedDrink.qty
that
"Cannot access: 'content/qty': it is public/package in SelectedDrink"
I just don't understand what's the error about, neither how to fix it.