So I have a camera intent where you create a picture about yourself, and then go straight to the secondactivity, passing the last took camera picture, in extra, but my app is not starting the another activity, what is the problem? I create the picture, and I get back to the main activity, without any action.
First Activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
ButtonClick = (Button)findViewById(R.id.button);
ButtonClick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
open();
}
});
}
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);
Intent mIntent = new Intent(this, SecondActivity.class);
Bitmap photo = (Bitmap) data.getExtras().get("data");
mIntent.putExtra("data", photo);
}
}
Second Activity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
imageView2 = (ImageView)this.findViewById(R.id.imageView2);
Bitmap bitmap = (Bitmap)this.getIntent().getParcelableExtra("data");
imageView2.setImageBitmap(bitmap);
}
Aucun commentaire:
Enregistrer un commentaire