title: Touch to image view not working
body: <p>I've made a simple app in which I am using 3 tabs. Each tab is having separate <code>classes</code> and <code>layouts</code>. First tab shows map. Second tab will show the camera from which the user can take picture(s) and third tab is off Pictures in which the captured images are viewed in the <code>GridView</code>. All tabs are working good. Now I want is to show full <code>ImageView</code> when a user tap on any image. </p>
  
  <p>For all of this I am using this <a href="http://www.androidhive.info/2013/09/android-fullscreen-image-slider-with-swipe-and-pinch-zoom-gestures/" rel="nofollow noreferrer">tutorial</a>. So I followed each and every step in it and the things are going good. But for full <code>ImageView</code> the code is not working. </p>
  
  <p>Below is my picture <code>Fragment</code> </p>
  
  <p><strong>Pictures.java</strong></p>
  
  <pre><code>public class Pictures extends Fragment implements MainActivity.Updateable {
  
  private Utils utils;
  private ArrayList&lt;String&gt; imagePaths = new ArrayList&lt;String&gt;();
  private GridViewImageAdapter adapter;
  private GridView gridView;
  private int columnWidth;
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.pictures, container, false);
  
      gridView = (GridView) rootView.findViewById(R.id.grid_view);
      utils = new Utils(getContext());
  
      // Initilizing Grid View
      InitilizeGridLayout();
  
      // loading all image paths from SD card
      imagePaths = utils.getFilePaths();
  
      // Gridview adapter
  
      adapter = new GridViewImageAdapter(getActivity(), imagePaths, columnWidth);
      /*adapter = new GridViewImageAdapter(Pictures.this, imagePaths,
              columnWidth);*/
  
      // setting grid view adapter
      gridView.setAdapter(adapter);
  
      //((BaseAdapter) adapter).notifyDataSetChanged();
      //adapter.notifyDataSetChanged();
  
  
      return rootView;
  }
  
  private void InitilizeGridLayout() {
  
      Resources r = getResources();
      float padding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
              AppConstant.GRID_PADDING, r.getDisplayMetrics());
  
      columnWidth = (int) ((utils.getScreenWidth() - ((AppConstant.NUM_OF_COLUMNS + 1) * padding)) / AppConstant.NUM_OF_COLUMNS);
  
      gridView.setNumColumns(AppConstant.NUM_OF_COLUMNS);
      gridView.setColumnWidth(columnWidth);
      gridView.setStretchMode(GridView.NO_STRETCH);
      gridView.setPadding((int) padding, (int) padding, (int) padding,
              (int) padding);
      gridView.setHorizontalSpacing((int) padding);
      gridView.setVerticalSpacing((int) padding);
  }
  
  
  @Override
  public void update() {
      if(adapter !=null)
      {
          adapter.notifyDataSetChanged();
  
      }
      else
      {
          Log.d(getTag(),"null");
      }
  }}
  </code></pre>
  
  <p>Now for full screen view, I have made a new <code>Activity</code> a two separate <code>Layouts</code> one for screen and one for image as below</p>
  
  <p><strong>fullscreen.xml</strong></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/pager"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" /&gt;&lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>fullscreenImage.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent" android:layout_height="match_parent"&gt;
  &lt;ImageView
      android:id="@+id/imgDisplay"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:scaleType="fitCenter" /&gt;
  
  &lt;Button
      android:id="@+id/btnClose"
      android:layout_width="wrap_content"
      android:layout_height="30dp"
      android:layout_alignParentRight="true"
      android:layout_alignParentTop="true"
      android:layout_marginRight="15dp"
      android:layout_marginTop="15dp"
      android:paddingTop="2dp"
      android:paddingBottom="2dp"
      android:background="@drawable/button_background"
      android:textColor="#ffffff"
      android:text="Close" /&gt;&lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Now i created a <code>Adapter</code> class</p>
  
  <p><strong>FullScreenImageAdapter.java</strong></p>
  
  <pre><code>public class FullScreenImageAdapter extends PagerAdapter {
  
  private Activity _activity;
  private ArrayList&lt;String&gt; _imagePaths;
  private LayoutInflater inflater;
  
  // constructor
  public FullScreenImageAdapter(Activity activity,
                                ArrayList&lt;String&gt; imagePaths) {
      this._activity = activity;
      this._imagePaths = imagePaths;
  }
  
  @Override
  public int getCount() {
      return this._imagePaths.size();
  }
  
  @Override
  public boolean isViewFromObject(View view, Object object) {
      return view == ((RelativeLayout) object);
  }
  
  @Override
  public Object instantiateItem(ViewGroup container, int position) {
      ImageView imgDisplay;
      Button btnClose;
  
      inflater = (LayoutInflater) _activity
              .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View viewLayout = inflater.inflate(R.layout.layout_fullscreen_image, container,
              false);
  
      imgDisplay = (ImageView) viewLayout.findViewById(R.id.imgDisplay);
      btnClose = (Button) viewLayout.findViewById(R.id.btnClose);
  
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inPreferredConfig = Bitmap.Config.ARGB_8888;
      Bitmap bitmap = BitmapFactory.decodeFile(_imagePaths.get(position), options);
      imgDisplay.setImageBitmap(bitmap);
  
      // close button click event
      btnClose.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              _activity.finish();
          }
      });
  
      ((ViewPager) container).addView(viewLayout);
  
      return viewLayout;
  }
  
  @Override
  public void destroyItem(ViewGroup container, int position, Object object) {
      ((ViewPager) container).removeView((RelativeLayout) object);
  
  }}
  </code></pre>
  
  <p>Now the full screen <code>Activity</code></p>
  
  <p><strong>FullScreenViewActivity.java</strong></p>
  
  <pre><code>public class FullScreenViewActivity extends Activity {
  
  private Utils utils;
  private FullScreenImageAdapter adapter;
  private ViewPager viewPager;
  
  @Override
  protected void onCreate(Bundle savedInstanceState){
  
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_fullscreen_view);
  
      viewPager = (ViewPager)findViewById(R.id.pager);
  
      utils = new Utils(getApplicationContext());
  
      Intent i = getIntent();
  
      int position = i.getIntExtra("position",0);
  
      adapter = new FullScreenImageAdapter(FullScreenViewActivity.this,
              utils.getFilePaths());
  
      viewPager.setAdapter(adapter);
  
      // displaying selected image first
      viewPager.setCurrentItem(position);
  
  }}
  </code></pre>
  
  <p>Now when i click on any image nothing happens, I got no errors on <code>logcat</code>, no any warnings nor any app crash.</p>
  
  <p>I have debugged the app but it doesn't goes to that point. </p>
  
  <p>I'm stuck to it, and don't know what to do</p>
  
  <p>Any help would be highly appreciated.</p>