title: How can I transfer bitmap image into another activity?
body: <p>Why is my code not functioning? i want to transfer image from one activity to another. Please help! Note: I have create a camera function and thats where I get image.</p>
  
  <p>This is the MainActivity.java</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  public static final int CAMERA_REQUEST = 9999;
  
  ImageView imageView1;
  Button camera,send;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      imageView1 = findViewById(R.id.imageView1);
      camera = findViewById(R.id.camera);
      send = findViewById(R.id.send);
  
      camera.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Intent d1 = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
              startActivityForResult(d1, CAMERA_REQUEST);
          }
      });
  
      send.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              imageView1.buildDrawingCache();
              Bitmap bitmap = imageView1.getDrawingCache();
  
              Intent intent = new Intent(MainActivity.this, ResultActivity.class);  
              intent.putExtra("bp", bitmap);
  
          }
      });
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      Bitmap bitmap = (Bitmap) data.getExtras().get("data");
      imageView1.setImageBitmap(bitmap);
  }
  }
  </code></pre>
  
  <p>This is the ResultActivity.java</p>
  
  <pre><code>public class ResultActivity extends AppCompatActivity {
  
  ImageView imageView2;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_result);
  
      imageView2 = findViewById(R.id.imageView2);
  
      Intent intent = new Intent();
      Bitmap bitmap = intent.getParcelableExtra("bp");
      imageView2.setImageBitmap(bitmap);
      }
  }  
  </code></pre>
  
  <p>If I've done something wrong. Please let me know. Thankssss  </p>