Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. RestAdapter restAdapter = new RestAdapter.Builder()
  2. .setEndpoint(CallerInfo.API_URL)
  3. .setLogLevel(RestAdapter.LogLevel.FULL)
  4. .build();
  5. InGameInfo igi = restAdapter.create(InGameInfo.class);
  6. Game game = igi.fetchInGameInfo("EUW", "sasquatching");
  7. Log.d("Cancantest", "Game " + game); //Not null
  8. Log.d("Cancantest", "Team one " + game.getTeamOne()); //Null
  9.  
  10. @SerializedName("teamTwo")
  11. @Expose private Team teamTwo;
  12. @SerializedName("teamOne")
  13. @Expose private Team teamOne;
  14.  
  15. public void setTeamOne(Team teamOne) {
  16. this.teamOne = teamOne;
  17. }
  18.  
  19. public void setTeamTwo(Team teamTwo) {
  20. this.teamTwo = teamTwo;
  21. }
  22.  
  23. public Team getTeamOne() {
  24. return teamOne;
  25. }
  26.  
  27. public Team getTeamTwo() {
  28. return teamTwo;
  29. }
  30.  
  31. @SerializedName("array")
  32. @Expose private TeamMember[] teamMembers;
  33.  
  34. public void setTeamMembers(TeamMember[] teamMembers) {
  35. this.teamMembers = teamMembers;
  36. }
  37.  
  38. public TeamMember[] getTeamMembers() {
  39. return teamMembers;
  40. }
  41.  
  42. {
  43. "game":{
  44. "teamTwo":{
  45. "array":[]
  46. },
  47. "teamOne":{
  48. "array":[]
  49. }
  50. }
  51. }
  52.  
  53. public class Response {
  54. public final Game game;
  55.  
  56. public Response(Game game) {
  57. this.game = game;
  58. }
  59. }
  60.  
  61. String data = "...";
  62. Game game = gson.fromJson(data, Game.class)
  63. Response response = gson.from Json(data, Response.class)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement