1
 public void onCreate(Bundle paramBundle)
  {
      super.onCreate(paramBundle);
      Bundle localBundle = getIntent().getExtras();
      setContentView(pager);
        String[] arrayOfString = localBundle.getStringArray("com.example.image.IMAGES");
        int i = localBundle.getInt("com.example.image.IMAGE_POSITION", 0);
        if (paramBundle != null)
          i = paramBundle.getInt("STATE_POSITION");
        this.options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_launcher).showImageOnFail(R.drawable.ic_launcher).resetViewBeforeLoading(true).cacheOnDisc(true).imageScaleType(ImageScaleType.NONE).bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(300)).build();
        this.pager = ((ViewPager)findViewById(R.id.myfivepanelpager));
      this.pager.setAdapter(new ImagePagerAdapter(arrayOfString));
        this.pager.setCurrentItem(i);
  }
  public void onSaveInstanceState(Bundle paramBundle)
  {
    paramBundle.putInt("STATE_POSITION", this.pager.getCurrentItem());
  }

   private class ImagePagerAdapter extends PagerAdapter
  {
        private String[] images;
        private LayoutInflater inflater;

        ImagePagerAdapter(String[] arg2)
        {
             Object localObject = null;
             this.images = (String[]) localObject;
             this.inflater = ImagePagerActivity.this.getLayoutInflater();;
        }

        public void destroyItem(View paramView, int paramInt, Object paramObject)
        {
          ((ViewPager)paramView).removeView((View)paramObject);
        }

        public void finishUpdate(View paramView)
        {
        }

        public int getCount()
        {
          return this.images.length;
        }

        public Object instantiateItem(View paramView, int paramInt)
        {
          FrameLayout localView = (FrameLayout)this.inflater.inflate(R.layout.item_pager, null);
          ImageView localImageView = (ImageView)localView.findViewById(R.id.imageView1);
          final ProgressBar localProgressBar = (ProgressBar)localView.findViewById(R.id.progressBar1);
          ImagePagerActivity.this.imageLoader.displayImage(this.images[paramInt], localImageView, ImagePagerActivity.this.options, new SimpleImageLoadingListener()
          {
            public void onLoadingComplete(String paramAnonymousString, View paramAnonymousView, Bitmap paramAnonymousBitmap)
            {
              localProgressBar.setVisibility(8);
            }



            public void onLoadingStarted(String paramAnonymousString, View paramAnonymousView)
            {
              localProgressBar.setVisibility(0);
            }
          });
          ((ViewPager)paramView).addView(localView, 0);
          return localView;
        }

        public boolean isViewFromObject(View paramView, Object paramObject)
        {
          return paramView.equals(paramObject);
        }

        public void restoreState(Parcelable paramParcelable, ClassLoader paramClassLoader)
        {
        }

        public Parcelable saveState()
        {
          return null;
        }

        public void startUpdate(View paramView)
        {       
    }
}
4

1 に答える 1

0

変化する

   setContentView(pager);

含むレイアウトのIDR.id.myfinepanepager

setContentView(R.layout.nameoflayout);
于 2013-07-07T11:27:34.303 に答える