嗨,我正在使用电影tmdb数据库来检索数据,解析后的json如下:
Find
以上的POJO如下:
生成的拳头如下
x.ImportanceFactor > 5 && x.ImportanceFactor < 10
第二个如下:
{
"page":1,
"results":[
{
"adult":false,
"backdrop_path":"/tbhdm8UJAb4ViCTsulYFL3lxMCd.jpg",
"genre_ids":[
53,
28,
12
],
"id":76341,
"original_language":"en",
"original_title":"Mad Max: Fury Road",
"overview":"An apocalyptic story set in the furthest reaches of our planet, in a stark desert landscape where humanity is broken, and most everyone is crazed fighting for the necessities of life. Within this world exist two rebels on the run who just might be able to restore order. There's Max, a man of action and a man of few words, who seeks peace of mind following the loss of his wife and child in the aftermath of the chaos. And Furiosa, a woman of action and a woman who believes her path to survival may be achieved if she can make it across the desert back to her childhood homeland.",
"release_date":"2015-05-15",
"poster_path":"/kqjL17yufvn9OVLyXYpvtyrFfak.jpg",
"popularity":51.773842,
"title":"Mad Max: Fury Road",
"video":false,
"vote_average":7.8,
"vote_count":1786
},
{
"adult":false,
"backdrop_path":"/kvXLZqY0Ngl1XSw7EaMQO0C1CCj.jpg",
"genre_ids":[
28,
12,
878
],
"id":102899,
"original_language":"en",
"original_title":"Ant-Man",
"overview":"Armed with the astonishing ability to shrink in scale but increase in strength, con-man Scott Lang must embrace his inner-hero and help his mentor, Dr. Hank Pym, protect the secret behind his spectacular Ant-Man suit from a new generation of towering threats. Against seemingly insurmountable obstacles, Pym and Lang must plan and pull off a heist that will save the world.",
"release_date":"2015-07-17",
"poster_path":"/7SGGUiTE6oc2fh9MjIk5M00dsQd.jpg",
"popularity":44.138852,
"title":"Ant-Man",
"video":false,
"vote_average":7.1,
"vote_count":946
},
{
"adult":false,
"backdrop_path":"/bIlYH4l2AyYvEysmS2AOfjO7Dn8.jpg",
"genre_ids":[
878,
28,
53,
12
],
"id":87101,
"original_language":"en",
"original_title":"Terminator Genisys",
"overview":"The year is 2029. John Connor, leader of the resistance continues the war against the machines. At the Los Angeles offensive, John's fears of the unknown future begin to emerge when TECOM spies reveal a new plot by SkyNet that will attack him from both fronts; past and future, and will ultimately change warfare forever.",
"release_date":"2015-07-01",
"poster_path":"/5JU9ytZJyR3zmClGmVm9q4Geqbd.jpg",
"popularity":37.160125,
"title":"Terminator Genisys",
"video":false,
"vote_average":6.3,
"vote_count":781
},
{
"adult":false,
"backdrop_path":"/dmnaqPsvJuBSoDtbd8BkDZzPGzi.jpg",
"genre_ids":[
35
],
"id":116741,
"original_language":"en",
"original_title":"The Internship",
"overview":"Two recently laid-off men in their 40s try to make it as interns at a successful Internet company where their managers are in their 20s.",
"release_date":"2013-06-07",
"poster_path":"/xxOKDTQbQo7h1h7TyrQIW7u8KcJ.jpg",
"popularity":31.049928,
"title":"The Internship",
"video":false,
"vote_average":6.1,
"vote_count":705
},
{
"adult":false,
"backdrop_path":"/t5KONotASgVKq4N19RyhIthWOPG.jpg",
"genre_ids":[
28,
12,
878,
53
],
"id":135397,
"original_language":"en",
"original_title":"Jurassic World",
"overview":"Twenty-two years after the events of Jurassic Park, Isla Nublar now features a fully functioning dinosaur theme park, Jurassic World, as originally envisioned by John Hammond.",
"release_date":"2015-06-12",
"poster_path":"/uXZYawqUsChGSj54wcuBtEdUJbh.jpg",
"popularity":26.753134,
"title":"Jurassic World",
"video":false,
"vote_average":7.0,
"vote_count":1950
},
{
"adult":false,
"backdrop_path":"/L5QRL1O3fGs2hH1LbtYyVl8Tce.jpg",
"genre_ids":[
53,
28,
878,
10749
],
"id":262500,
"original_language":"en",
"original_title":"Insurgent",
"overview":"Beatrice Prior must confront her inner demons and continue her fight against a powerful alliance which threatens to tear her society apart.",
"release_date":"2015-03-20",
"poster_path":"/aBBQSC8ZECGn6Wh92gKDOakSC8p.jpg",
"popularity":25.195584,
"title":"Insurgent",
"video":false,
"vote_average":6.9,
"vote_count":933
},
{
"adult":false,
"backdrop_path":"/sLbXneTErDvS3HIjqRWQJPiZ4Ci.jpg",
"genre_ids":[
10751,
16,
12,
35
],
"id":211672,
"original_language":"en",
"original_title":"Minions",
"overview":"Minions Stuart, Kevin and Bob are recruited by Scarlet Overkill, a super-villain who, alongside her inventor husband Herb, hatches a plot to take over the world.",
"release_date":"2015-06-25",
"poster_path":"/s5uMY8ooGRZOL0oe4sIvnlTsYQO.jpg",
"popularity":24.605627,
"title":"Minions",
"video":false,
"vote_average":6.9,
"vote_count":993
},
{
"adult":false,
"backdrop_path":"/uHeMMJIZRVjeS2WIFcxBCdCTdmk.jpg",
"genre_ids":[
28,
12,
53
],
"id":177677,
"original_language":"en",
"original_title":"Mission: Impossible – Rogue Nation",
"overview":"Ethan and team take on their most impossible mission yet, eradicating the Syndicate - an International rogue organization as highly skilled as they are, committed to destroying the IMF.",
"release_date":"2015-07-31",
"poster_path":"/6PgpI2Uj4s1solkGWaYXP5QgO1I.jpg",
"popularity":24.128192,
"title":"Mission: Impossible – Rogue Nation",
"video":false,
"vote_average":7.2,
"vote_count":515
},
{
"adult":false,
"backdrop_path":"/nkwoiSVJLeK0NI8kTqioBna61bm.jpg",
"genre_ids":[
35
],
"id":214756,
"original_language":"en",
"original_title":"Ted 2",
"overview":"Newlywed couple Ted and Tami-Lynn want to have a baby, but in order to qualify to be a parent, Ted will have to prove he's a person in a court of law.",
"release_date":"2015-06-26",
"poster_path":"/A7HtCxFe7Ms8H7e7o2zawppbuDT.jpg",
"popularity":20.634718,
"title":"Ted 2",
"video":false,
"vote_average":6.9,
"vote_count":576
},
{
"adult":false,
"backdrop_path":"/aUYcExsGuRaw7PLGmAmXubt1dfG.jpg",
"genre_ids":[
10749,
14,
10751,
18
],
"id":150689,
"original_language":"en",
"original_title":"Cinderella",
"overview":"When her father unexpectedly passes away, young Ella finds herself at the mercy of her cruel stepmother and her daughters. Never one to give up hope, Ella's fortunes begin to change after meeting a dashing stranger in the woods.",
"release_date":"2015-03-13",
"poster_path":"/2i0JH5WqYFqki7WDhUW56Sg0obh.jpg",
"popularity":18.480602,
"title":"Cinderella",
"video":false,
"vote_average":7.0,
"vote_count":558
},
{
"adult":false,
"backdrop_path":"/lyVlbE8iRIdGBUwhq79EziqHSBW.jpg",
"genre_ids":[
28,
12,
878
],
"id":166424,
"original_language":"en",
"original_title":"Fantastic Four",
"overview":"Four young scientists teleport to an alternate and dangerous universe, which alters their physical form in shocking ways. They must now use these abilities to save the world from a former friend turned enemy.",
"release_date":"2015-08-07",
"poster_path":"/g23cs30dCMiG4ldaoVNP1ucjs6.jpg",
"popularity":17.614168,
"title":"Fantastic Four",
"video":false,
"vote_average":4.9,
"vote_count":271
},
{
"adult":false,
"backdrop_path":"/2BXd0t9JdVqCp9sKf6kzMkr7QjB.jpg",
"genre_ids":[
12,
10751,
16,
28,
35
],
"id":177572,
"original_language":"en",
"original_title":"Big Hero 6",
"overview":"The special bond that develops between plus-sized inflatable robot Baymax, and prodigy Hiro Hamada, who team up with a group of friends to form a band of high-tech heroes.",
"release_date":"2014-11-07",
"poster_path":"/3zQvuSAUdC3mrx9vnSEpkFX0968.jpg",
"popularity":17.35535,
"title":"Big Hero 6",
"video":false,
"vote_average":7.9,
"vote_count":2084
},
{
"adult":false,
"backdrop_path":"/xu9zaAevzQ5nnrsXN6JcahLnG4i.jpg",
"genre_ids":[
18,
878
],
"id":157336,
"original_language":"en",
"original_title":"Interstellar",
"overview":"Interstellar chronicles the adventures of a group of explorers who make use of a newly discovered wormhole to surpass the limitations on human space travel and conquer the vast distances involved in an interstellar voyage.",
"release_date":"2014-11-05",
"poster_path":"/nBNZadXqJSdt05SHLqgT0HuC5Gm.jpg",
"popularity":16.96893,
"title":"Interstellar",
"video":false,
"vote_average":8.4,
"vote_count":3108
},
{
"adult":false,
"backdrop_path":"/fii9tPZTpy75qOCJBulWOb0ifGp.jpg",
"genre_ids":[
36,
18,
53,
10752
],
"id":205596,
"original_language":"en",
"original_title":"The Imitation Game",
"overview":"Based on the real life story of legendary cryptanalyst Alan Turing, the film portrays the nail-biting race against time by Turing and his brilliant team of code-breakers at Britain's top-secret Government Code and Cypher School at Bletchley Park, during the darkest days of World War II.",
"release_date":"2014-11-14",
"poster_path":"/noUp0XOqIcmgefRnRZa1nhtRvWO.jpg",
"popularity":15.565414,
"title":"The Imitation Game",
"video":false,
"vote_average":8.1,
"vote_count":1706
},
{
"adult":false,
"backdrop_path":"/qhH3GyIfAnGv1pjdV3mw03qAilg.jpg",
"genre_ids":[
12,
14
],
"id":122917,
"original_language":"en",
"original_title":"The Hobbit: The Battle of the Five Armies",
"overview":"Mere seconds after the events of \"Desolation\", Bilbo and Company continue to claim a mountain of treasure that was guarded long ago: But with Gandalf the Grey also facing some formidable foes of his own, the Hobbit is outmatched when the brutal army of orcs led by Azog the Defiler returns. But with other armies such as the elves and the men of Lake-Town, which are unsure to be trusted, are put to the ultimate test when Smaug's wrath, Azog's sheer strength, and Sauron's force of complete ends attack. All in all, the trusted armies have two choices: unite or die. But even worse, Bilbo gets put on a knife edge and finds himself fighting with Hobbit warfare with all of his might for his dwarf-friends, as the hope for Middle-Earth is all put in Bilbo's hands. The one \"precious\" thing to end it all.",
"release_date":"2014-12-17",
"poster_path":"/qrFwjJ5nvFnpBCmXLI4YoeHJNBH.jpg",
"popularity":15.370585,
"title":"The Hobbit: The Battle of the Five Armies",
"video":false,
"vote_average":7.2,
"vote_count":1788
},
{
"adult":false,
"backdrop_path":"/nvZVu6inpwLHKqRXZhye3S4uqei.jpg",
"genre_ids":[
28,
35,
878
],
"id":257344,
"original_language":"en",
"original_title":"Pixels",
"overview":"Video game experts are recruited by the military to fight 1980s-era video game characters who've attacked New York.",
"release_date":"2015-07-24",
"poster_path":"/ktyVmIqfoaJ8w0gDSZyjhhOPpD6.jpg",
"popularity":14.724169,
"title":"Pixels",
"video":false,
"vote_average":6.4,
"vote_count":253
},
{
"adult":false,
"backdrop_path":"/bHarw8xrmQeqf3t8HpuMY7zoK4x.jpg",
"genre_ids":[
878,
14,
12
],
"id":118340,
"original_language":"en",
"original_title":"Guardians of the Galaxy",
"overview":"Light years from Earth, 26 years after being abducted, Peter Quill finds himself the prime target of a manhunt after discovering an orb wanted by Ronan the Accuser.",
"release_date":"2014-08-01",
"poster_path":"/9gm3lL8JMTTmc3W4BmNMCuRLdL8.jpg",
"popularity":14.551749,
"title":"Guardians of the Galaxy",
"video":false,
"vote_average":8.1,
"vote_count":3255
},
{
"adult":false,
"backdrop_path":"/pfyWJUxrBTT2UIPoEQF3iFTHcQT.jpg",
"genre_ids":[
80,
35,
28,
12
],
"id":207703,
"original_language":"en",
"original_title":"Kingsman: The Secret Service",
"overview":"Kingsman: The Secret Service tells the story of a super-secret spy organization that recruits an unrefined but promising street kid into the agency's ultra-competitive training program just as a global threat emerges from a twisted tech genius.",
"release_date":"2015-02-13",
"poster_path":"/8x7ej0LnHdKUqilNNJXYOeyB6L9.jpg",
"popularity":14.532191,
"title":"Kingsman: The Secret Service",
"video":false,
"vote_average":7.7,
"vote_count":1832
},
{
"adult":false,
"backdrop_path":"/anItUS64TeGKPv6MJ99DMv7o0Z0.jpg",
"genre_ids":[
35,
10402
],
"id":254470,
"original_language":"en",
"original_title":"Pitch Perfect 2",
"overview":"The Bellas are back, and they are better than ever. After being humiliated in front of none other than the President of the United States of America, the Bellas are taken out of the Aca-Circuit. In order to clear their name, and regain their status, the Bellas take on a seemingly impossible task: winning an international competition no American team has ever won. In order to accomplish this monumental task, they need to strengthen the bonds of friendship and sisterhood and blow away the competition with their amazing aca-magic! With all new friends and old rivals tagging along for the trip, the Bellas can hopefully accomplish their dreams.",
"release_date":"2015-05-15",
"poster_path":"/qSjruLiFB4uqRtz2xheQPxG8uaB.jpg",
"popularity":13.765999,
"title":"Pitch Perfect 2",
"video":false,
"vote_average":7.1,
"vote_count":450
},
{
"adult":false,
"backdrop_path":"/A0bFdUMtd4mcXMRou7alzk6HQVZ.jpg",
"genre_ids":[
35,
28,
12
],
"id":203801,
"original_language":"en",
"original_title":"The Man from U.N.C.L.E.",
"overview":"In the early 1960s, CIA agent Napoleon Solo and KGB operative Illya Kuryakin participate in a joint mission against a mysterious criminal organization, which is working to proliferate nuclear weapons.",
"release_date":"2015-08-14",
"poster_path":"/5ttOaThDVmTpV8iragbrhdfxEep.jpg",
"popularity":13.33388,
"title":"The Man from U.N.C.L.E.",
"video":false,
"vote_average":5.9,
"vote_count":83
}
],
"total_pages":11963,
"total_results":239260
}
现在我如何使用改造来解析数据以及如何使用Recycler视图进行上述操作。
答案 0 :(得分:0)
Retrofit负责解析,您不需要处理&#34; 2 POJOS&#34;,改造使用您的主要POJO Example
类:
public interface YourService {
@GET("/path/to/your/rest/api")
void yourJSONRequest(Callback<Example> callback);
}
你的电话应该是这样的:
yourJSONRequest(new Callback<Example>() {
@Override
public void success(Example example, Response response) {
// Do whatever you want
for(Result result : example.getResults()){
// Here is your result
}
}
@Override
public void failure(RetrofitError error) {
// Error handling
}
});