I have two activity , the first activity (camera Activity) contain two button one to open the camera , and the second activity display form contain the image view I need to pass the bitmap that capture from camera in another FORM activity ,the camera open and taken the image and this image put on imageview on another Activity but my code is taken image and return to first activity does not display on second activity ?
the camera code
public class camera extends Activity {
static final int REQUEST_IMAGE_CAPTURE = 1;
private static final int CAMERA_REQUEST = 1888;
ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);
//register
Button camera = (Button)findViewById(R.id.s_camera);
camera.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
open();
}
});
Button call = (Button)findViewById(R.id.s_call);
call.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Uri uri = Uri.parse("tel:0555064740");
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}
});
}
public void open(){
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent,0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==CAMERA_REQUEST&&resultCode==RESULT_OK) {
Bitmap bp = (Bitmap) data.getExtras().get("data");
Intent intent = new Intent(getApplicationContext(), formActivity.class);
intent.putExtra("BitmapImage", bp);
}
}
the formActivity
public class formActivity extends Activity {
private static final int CAMERA_REQUEST = 1888;
private ImageView imageView;
Bitmap photo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_form);
getData();
}
private void getData(){
Bitmap bitImage=getIntent().getParcelableExtra("BitmapImage");
imageView.setImageBitmap(bitImage);
}
any one can help me ???