I'm having some trouble with a ViewPager...
So I have a JsonObject (World Weather Online) which has an array "Weather" containing 7 childs object, and each of these Object contain a single array "Hourly" which has 8 childs object.
I would like to use the array "weather" and its 7 childs to determine the number a swipeable screens and display the date in the PageTitleStrip. And each of these swipeable views would contain a ListView with the 8 objects contained in the "Hourly" array as items.
I do it properly with dummy datas using xml arrays in values but obvioulsy having trouble with a JsonObject.
Can anyone help and explain to me how I could achieve it?
The first one, you should parse that json array to weather model which has hourly datas in each of them array.
In your PagerAdapter you should override getCount that return size of model array.
Again in your PagerAdapter you also should override getItem that returns WeatherFragment. You need to pass one of the weather model to your WeatherFragment. Please check Bundle usage with Fragments.
In your WeatherFragment you need to have a ArrayAdapter to fill ListView with your hourly datas.
Your Weather Array need to be singleton.
Good luck there.