Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Eduardo Ricardez
Eduardo Ricardez
115 Points

send List of List of Objects with retrofit2

DateFormat formatoFechaOrden = new SimpleDateFormat("dd MM yyyy HH:mm");

    String restaurantId=getIntent().getStringExtra("restaurantId");

    String dateValue =formatoFechaOrden.format(hora.getTime());

    List<List<Meal>> mealsClientes = obtenerListasAlimentos();

    Boolean reservationStatus= false;

    int clients = listaCliente.size();

    Boolean onPlace=getIntent().getBooleanExtra("onPlace",false);

    String remarques = tvRemarques.getText().toString();

    User user = new User(session.getUserDetails().get("id"),session.getUserDetails().get("email"),session.getUserDetails().get("name"));

    List<List<Integer>>howMany = new ArrayList<>();

    List<Meal> menus = (List<Meal>) getIntent().getSerializableExtra("menus");

I have the follows variables that i want to send, i have tryied with GSON sending all in an objects, but is not working , how can i send List<List<Meal>>meals with retrofit2 ????

    Order order = new Order(restaurantId,dateValue,mealsClientes,user,reservationStatus,clients,howMany,b,menus,onPlace,remarques,priceLeftToPay);

Call<ResponseBody> call = service.createOrder(order);

@POST("createOrder?token=FYfZ%2Fo28Mva6MGYnFOdiSOPPdVwSbTuYd86P3wYlq%2Fb5CDqHJwUgQKX5aALSiBP4XQC3TswG8I37%2F4K62ZUnx11n3MIc7sckbDCs8kFbbDMbuql8p0chLLHV20FLu90DfyCSkSvP9D2NAHgNAF8jk76%2B717S2qo%2F7XCw7QQtxIc%3D") Call<ResponseBody>createOrder(@Body Order order);