title: Select image from grid view and show it in next activity and in this activity there are buttons to capture image and also to save it
body: <p>I am showing images from my gridview.
  When an image is selected it is shown in new activity.
  In new activity there is 2 buttons one to capture image and one to save it along with the image chosen from gridview.
  My problem is that when I select image from gridview then the buttons in the next activity do not respond.And when they respond then chosen image from gridview is not shown.
  Capture image and save buttons logic is in different class.
  I am trying to call these by intent.</p>
  
  <p>this is my code where the problem is,when i am using two intent then also only is working.</p>
  
  <pre><code>          public class SingleItemView extends Activity {
             //final static int CAMERA_RESULT = 0;
            ImageView imv;    private int TAKENPHOTO = 0;
  
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  @Override
  public void onCreate(Bundle savedInstanceState) {
  
  
      super.onCreate(savedInstanceState);
      // Get the view from singleitemview.xml
      setContentView(R.layout.singleitemview);
  
  
      // Get position from intent passed from MainActivity.java
      Intent i = getIntent();
      //startActivityForResult(i, 1);
  
      int position = i.getExtras().getInt("id");
  
      // Open the Image adapter
      ImageAdapter imageAdapter = new ImageAdapter(this);
  
  
      // Locate the ImageView in singleitemview.xml
      ImageView imageView = (ImageView) findViewById(R.id.image);
  
      // Get image and position from ImageAdapter.java and set into ImageView
  
      imageView.setImageResource(imageAdapter.mThumbIds[position]);
      //i = new Intent(SingleItemView.this, saveandshare.class);
  //  startActivityForResult(i, 1);
      //Intent openNewActivity = new Intent(getApplicationContext(), saveandshare.class);
  //  startActivity(openNewActivity);
  
  
  
  }
  
  
  
  
      protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
      super.onActivityResult(requestCode, resultCode, intent);
  
      if (resultCode == RESULT_OK) {
              Bundle extras = intent.getExtras();
              Bitmap bmp = (Bitmap) extras.get("data");
          imv = (ImageView) findViewById(R.id.imageView);
      imv.setImageBitmap(bmp);
  
  
  
  
      }
  
  
  }
  </code></pre>