将通用图像加载器与页面浏览器集成时出错?

时间:2013-07-07 13:18:33

标签: android view android-viewpager viewgroup

Error link 我是初学者。我无法在这里附上图片。我在上面附上了我的错误链接。 我创建了pager xml并定义了view pager id。我创建了另一个名为item pager的xml,我定义了图像和进度ID。

public void onCreate(Bundle paramBundle)

{

   super.onCreate(paramBundle);


   Bundle localBundle = getIntent().getExtras();

   setContentView(R.layout.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(Rdrawable.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)
        {       
        }
}

1 个答案:

答案 0 :(得分:0)

最后我修复了它...问题是使用bundle

从另一个活动中获取值