Android 从internet下载数据时在splashscreen中显示进度条

Android 从internet下载数据时在splashscreen中显示进度条,android,fragment,background-process,Android,Fragment,Background Process,我需要知道如何在后台解析来自在线xml的数据,并在listview中显示它 目前我有一个班级正在扩展碎片活动。下面是班级的布局 <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pager" android:layout_width="match_parent" android:layout_

我需要知道如何在后台解析来自在线xml的数据,并在listview中显示它

目前我有一个班级正在扩展碎片活动。下面是班级的布局

 <android.support.v4.view.ViewPager
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/pager"
   android:layout_width="match_parent" 
   android:layout_height="match_parent"/>
有两个内部类MyTableListener和ViewPageAdapter。下面是MyTabListener类

  public class MyTabsListener implements ActionBar.TabListener {
protected TabOneActivity oneContext;
protected TabTwoActivity twoContext;
protected TabThreeActivity threeContext;
protected TabFourActivity fourContext;
protected TabFiveActivity fiveContext;
protected TabSixActivity sixcontext;


public MyTabsListener(TabOneActivity onetab) {
    // TODO Auto-generated constructor stub
    this.oneContext=onetab;
}

public MyTabsListener(TabTwoActivity twoTab) {
    // TODO Auto-generated constructor stub
    this.twoContext=twoTab;
}
public MyTabsListener(TabThreeActivity threeTab) {
    // TODO Auto-generated constructor stub
    this.threeContext=threeTab;
}
public MyTabsListener(TabFourActivity fourTab) {
    this.fourContext= fourTab;
}
public MyTabsListener(TabFiveActivity fiveTab) {
    // TODO Auto-generated constructor stub
    this.fiveContext=fiveTab;
} 
public MyTabsListener(TabSixActivity sixTab) {
    // TODO Auto-generated constructor stub
    this.sixContext=sixTab;
}



@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {      
    viewPager.setCurrentItem(tab.getPosition());
}

@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {        
    viewPager.setCurrentItem(tab.getPosition());

}
下面是ViewPagerAdapter类

 public class ViewPagerAdapter extends FragmentPagerAdapter {

final int PAGE_COUNT = 6;
public ViewPagerAdapter(FragmentManager supportFragmentManager) {
    // TODO Auto-generated constructor stub
    super(supportFragmentManager);
}

@Override
public Fragment getItem(int position) {
    // TODO Auto-generated method stub
    switch(position){
case 0:
    return TabOneActivity.create(position);     
case 1:
    return TabTwoActivity.create(position);
case 2:
    return TabThreeActivity.create(position);
case 3:
    return TabFourActivity.create(position);
case 4:
    return TabFiveActivity.create(position);
case 5:
    return TabSixActivity.create(position);
default :
    return TabOneActivity.create(position);
 }     
  }
@Override
public int getCount() {
    // TODO Auto-generated method stub
    return PAGE_COUNT;
}

  }
每个活动都在使用AsyncTask扩展片段并命中和解析联机xml,并在listview中显示结果

在将数据填充到listview之前,我将显示一个progressbar

我需要做的是在启动屏幕上显示一个进度条,在后台应该点击并解析在线数据,然后在一个post execute中显示listview中的数据

这将使UI看起来很好,因为用户不需要等待数据在主屏幕中加载,而是在spalsh屏幕中下载

请建议如何实现这一点。因为我使用的是一个FragmentActivity,它有六个不同的片段命中六个不同的URL

 public class ViewPagerAdapter extends FragmentPagerAdapter {

final int PAGE_COUNT = 6;
public ViewPagerAdapter(FragmentManager supportFragmentManager) {
    // TODO Auto-generated constructor stub
    super(supportFragmentManager);
}

@Override
public Fragment getItem(int position) {
    // TODO Auto-generated method stub
    switch(position){
case 0:
    return TabOneActivity.create(position);     
case 1:
    return TabTwoActivity.create(position);
case 2:
    return TabThreeActivity.create(position);
case 3:
    return TabFourActivity.create(position);
case 4:
    return TabFiveActivity.create(position);
case 5:
    return TabSixActivity.create(position);
default :
    return TabOneActivity.create(position);
 }     
  }
@Override
public int getCount() {
    // TODO Auto-generated method stub
    return PAGE_COUNT;
}

  }