method unable to retrieve value
<p>I am trying to pass my book issue number </p>

<pre><code>UrlPagerAdapter pagerAdapter = new UrlPagerAdapter(this,items,issue);
</code></pre>

<p>and then in my UrlPagerAdapter class, I logged the issue value in some methods to test out if my value has been successfully passed and yes, it did. but when i tried to create my own method to log the value, it doesn't work! </p>

<pre><code>public int getIssueNumber(){
    Log.d("issue - getIssueNumber()", String.valueOf(issue));
    return issue;
}
</code></pre>

<p>this is my urlpageradapter class</p>

<pre><code>public class UrlPagerAdapter extends PagerAdapter {

    private List&lt;String&gt; mResources;
    private Context mContext;
    private int issue;

    public UrlPagerAdapter(Context context, List&lt;String&gt; resources, int issue){
        this.mResources = resources;
        this.mContext = context;
        this.issue = issue;
    }

    @Override
    public void setPrimaryItem(ViewGroup container, int position, Object object) {
        super.setPrimaryItem(container, position, object);
        ((GalleryViewPager)container).mCurrentView = ((UrlTouchImageView)object).getImageView();
    }


    @Override
    public Object instantiateItem(View collection, int position){
        UrlTouchImageView iv = new UrlTouchImageView(mContext);
        iv.setUrl(mResources.get(position));
        iv.setLayoutParams(new Gallery.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        ((ViewPager) collection).addView(iv, 0);
        return iv;


    }

    @Override
    public void destroyItem(View collection, int position, Object view){
        ((ViewPager) collection).removeView((View) view);
    }

    @Override
    public int getCount(){
        return mResources.size();
    }

    public int getIssueNumber(){
        return issue;
    }

    @Override
    public boolean isViewFromObject(View view, Object object){
        return view.equals(object);
    }

    @Override
    public void finishUpdate(View arg0){
    }

    @Override
    public void restoreState(Parcelable arg0, ClassLoader arg1){
    }

    @Override
    public Parcelable saveState(){
        return null;
    }

    @Override
    public void startUpdate(View arg0){
    }

}
</code></pre>

<p>and in another class, i tried to test out the method. my application crashes!</p>

<pre><code>public class UrlTouchImageView extends RelativeLayout {
    protected ProgressBar mProgressBar;
    protected TouchImageView mImageView;

    protected Context mContext;
    UrlPagerAdapter pagerAdapter;
    String[] mImageIds;
    ArrayList&lt;String&gt;  mStringList= new ArrayList&lt;String&gt;();

    public UrlTouchImageView(Context ctx)
    {
        super(ctx);
        mContext = ctx;

        init();

    }
    public UrlTouchImageView(Context ctx, AttributeSet attrs)
    {
        super(ctx, attrs);
        mContext = ctx;
        init();
    }
    public TouchImageView getImageView() { return mImageView; }

    protected void init() {


        int v = pagerAdapter.getIssueNumber();
        Log.d(" v - ImageLoadTask", String.valueOf(v));

        mImageView = new TouchImageView(mContext);
        LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
        mImageView.setLayoutParams(params);
        this.addView(mImageView);
        mImageView.setVisibility(GONE);

        mProgressBar = new ProgressBar(mContext, null, android.R.attr.progressBarStyleHorizontal);
        params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.CENTER_VERTICAL);
        params.setMargins(30, 0, 30, 0);
        mProgressBar.setLayoutParams(params);
        mProgressBar.setIndeterminate(true);
        this.addView(mProgressBar);
    }

    public void setUrl(String imageUrl)
    {
        new ImageLoadTask().execute(imageUrl);
    }
    //No caching load
    public class ImageLoadTask extends AsyncTask&lt;String, Integer, Bitmap&gt;
    {
        //RETRIEVES LINK FROM GALLERYACTIVITY
        //READ MNT/SDCARD/....

        @Override
        protected Bitmap doInBackground(String... strings) {
            //String url = strings[0];

            Bitmap bm = null;
            try {
            File strPath = new File(Environment.getExternalStorageDirectory() + "/issue0");
            int lists = strPath.listFiles().length; 
            Log.d("number of items in array ",String.valueOf(lists));

            File yourDir = new File(strPath, "");
            for (File f : yourDir.listFiles()) {
                if (f.isFile())
                {
                    String name = f.getName();
                    String v = strPath + "/" + name;
                    mStringList.add(v);
                }
            }

            mImageIds = new String[mStringList.size()];
            mImageIds = mStringList.toArray(mImageIds);

                bm = BitmapFactory.decodeFile(mImageIds[0]);

            } catch (Exception e) {
                e.printStackTrace();
            }

            return bm;
        }

        @Override
        protected void onPostExecute(Bitmap bitmap) {
            mImageView.setImageBitmap(bitmap);
            mImageView.setVisibility(VISIBLE);
            mProgressBar.setVisibility(GONE);
        }
    }
}
</code></pre>

<p>this is my logcat output</p>

<pre><code>01-14 10:59:45.130: E/AndroidRuntime(21843): FATAL EXCEPTION: main
01-14 10:59:45.130: E/AndroidRuntime(21843): java.lang.NullPointerException
01-14 10:59:45.130: E/AndroidRuntime(21843):    at com.example.touchview.UrlTouchImageView.init(UrlTouchImageView.java:67)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at com.example.touchview.UrlTouchImageView.&lt;init&gt;(UrlTouchImageView.java:53)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at com.example.gallery.UrlPagerAdapter.instantiateItem(UrlPagerAdapter.java:58)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:801)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.support.v4.view.ViewPager.populate(ViewPager.java:930)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.support.v4.view.ViewPager.populate(ViewPager.java:881)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1366)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.View.measure(View.java:12723)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1017)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:555)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.View.measure(View.java:12723)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.View.measure(View.java:12723)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:812)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.View.measure(View.java:12723)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.View.measure(View.java:12723)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.os.Looper.loop(Looper.java:137)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at android.app.ActivityThread.main(ActivityThread.java:4446)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at java.lang.reflect.Method.invokeNative(Native Method)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at java.lang.reflect.Method.invoke(Method.java:511)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-14 10:59:45.130: E/AndroidRuntime(21843):    at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>What went wrong? </p>
