答案 0 :(得分:0)
你需要创建一个对象来处理响应,在这个对象中,你需要一个对象列表RolesDtos
(因为是一个对象数组)
public class RolesDtos{
int ID;
String Name;
String prices;
String Users;
...
setters and getters
}
public class ResponseObject{
int ID;
String userName;
String email;
String password;
String skypeId;
...
List<RolesDtos> rolesDtos; // <- here
...
setters and getters
}
要获得"Name": "AccountManager"
,您必须执行以下操作:
ResponseObject responseObject = new ResponseObject();
responseObject.getRolesDtos().get(0).getName();
get(0)
是数组的位置,因此,您必须迭代数组。现在在请求中你必须做这样的事情:
@GET("url")
Call<ResponseObject> theRequest(...)
我希望这可以帮到你
答案 1 :(得分:0)
How i can set here the "Name": "AccountManager" property?
User user = getItem(position);
if (user != null) {
TextView tvUserId = (TextView) v.findViewById(R.id.user_id);
TextView tvUserName = (TextView) v.findViewById(R.id.user_name);
TextView tvEmail=(TextView)v.findViewById(R.id.email);
TextView tvRole=(TextView)v.findViewById(R.id.userRole);
tvUserId.setText( Integer.toString(user.ID));
tvUserName.setText(user.UserName);
tvEmail.setText(user.Email);
// tvRole.setText(user.getRolesDtos().toArray(1));