I have an application that uses fragments to create a page adapter. I use this to create a swipe tab that loads another fragment. Each fragment loads a web view that displays a specially formatted website. Right now, my application only downloads fragments, as well as those that are on the left and right of it. I would like to download all six tabs at once and never again. Is there any way to do this?
import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { ViewPager viewPager=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewPager = (ViewPager) findViewById(R.id.pager); FragmentManager fragmentManager=getSupportFragmentManager(); viewPager.setAdapter(new MyAdapter(fragmentManager)); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } } class MyAdapter extends FragmentPagerAdapter { public MyAdapter(FragmentManager fm) { super(fm); // TODO Auto-generated constructor stub } @Override public Fragment getItem(int i) { Fragment fragment=null; if(i==0)fragment=new Introduction(); if(i==1)fragment=new Arena(); if(i==2)fragment=new Game(); if(i==3)fragment=new Robot(); if(i==4)fragment=new Tournament(); if(i==5)fragment=new Glossary(); return fragment; } @Override public int getCount() { // TODO Auto-generated method stub return 6; } public CharSequence getPageTitle(int position) { String title=new String(); if(position==0)return "Summary"; if(position==1)return "The Arena"; if(position==2)return "The Game"; if(position==3)return "The Robot"; if(position==4)return "The Tournament"; if(position==5)return "Glossary"; return null; } }
android android-fragments android-webview
Aqua morph
source share