Question

Error link I am beginner. I couldn't attach image here. I attached my error link above. I created pager xml and defined view pager id. And I created another one xml called item pager and I defined image and progress 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)
        {       
        }
}
Was it helpful?

Solution

Finally i fixed it...the problem is getting the value from another activity using bundle

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top