title: Listview to another activity with image views?
body: <p>I have a listview inside a fragment class. When a listview item is clicked another activity is opened. The xml file of that activity has 2 imageviews inside a scroll view. The images change with respect to every listview item clicked. No matter which listview item i click on it shows the same image view. In my case it shows the R.drawable.geet94 no mater which listview item i click. </p>
  
  <pre><code>public class urdufrag1 extends Fragment {
  
      public urdufrag1() {
          // Required empty public constructor
      }
  
      public void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
  
      }
  
      private static final String TAG = "urdufrag1";
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup 
      main_content, @Nullable Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.geetfrag_urdu, main_content, false);
  
  
  
           final int[] menuImage = {R.drawable.tgeet94, 
           R.drawable.tgeet95,R.drawable.tgeet96,R.drawable.tgeet97};
          final ListView listView = (ListView) view.findViewById(R.id.GeetListU);
  
          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long l) {
                Intent intent = new Intent(getActivity(), PackageG.class);
                  //intent.putExtra("GeetType", 
          listView.getItemAtPosition(position).toString());
                  //intent.putExtra("GeetType", Integer.toString(position));
                  intent.putExtra("position", Integer.toString(position));
                  startActivity(intent);
  
              }
          });
          AdapterGeetUrdu adapter = new AdapterGeetUrdu(getContext(), menuImage);
          listView.setAdapter(adapter);
  
          // Inflate the layout for this fragment
  
  
  
          return view;
      }
  }
  </code></pre>
  
  <p>Second Activity </p>
  
  <pre><code>public class PackageG extends AppCompatActivity {
  
      ImageView img1, img2;
      PhotoViewAttacher mAttacher;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_package_g);
  
          img1 = (ImageView) findViewById(R.id.imageView8);
          img2 = (ImageView) findViewById(R.id.imageView9);
          mAttacher = new PhotoViewAttacher(img1);
          mAttacher = new PhotoViewAttacher(img2);
  
          Intent intent = this.getIntent();
          if(intent != null){
              Integer position = intent.getExtras().getInt("position");
  
              switch (position){
  
                  case 0: img1.setImageResource(R.drawable.geet94);
                          img2.setImageResource(R.drawable.geet94_1);
                      break;
                  case 1: img1.setImageResource(R.drawable.geet95);
                          img2.setImageResource(R.drawable.geet95_1);
                      break;
                  case 2: img1.setImageResource(R.drawable.geet96);
                          img2.setImageResource(R.drawable.geet96_1);
                      break;
  
                  default:
                      img1.setImageResource(R.drawable.carol);
                      img2.setImageResource(R.drawable.carol);
                      break;
  
              }
  
          }
  
          mAttacher.update();
  
      }
  }
  </code></pre>