Back to project page android-weather-demo-application.
The source code is released under:
GNU General Public License
If you think the Android project android-weather-demo-application listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.openweathermap.adapter; //from ww w . j a v a 2 s . co m import java.util.ArrayList; import java.util.List; import org.openweathermap.fragment.ForecastFragment; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class ForecastAdapter extends FragmentPagerAdapter { private List<Fragment> mFragments; public ForecastAdapter(FragmentManager fragmentManager, int resultCount) { super(fragmentManager); mFragments = new ArrayList<Fragment>(); for (int i = 0; i < resultCount; i++) { Bundle args = new Bundle(); args.putInt(ForecastFragment.ARG_DATA_POSITION, i); ForecastFragment forecastFragment = new ForecastFragment(); forecastFragment.setArguments(args); mFragments.add(forecastFragment); } } @Override public Fragment getItem(int position) { return mFragments.get(position); } @Override public int getCount() { return mFragments.size(); } }