So, after I finish my scanner activity with
btn_take_photo.setOnClickListener(new FloatingActionButton.OnClickListener() {
@Override
public void onClick(View view) {
String carde = cardnumberbox.getText().toString().trim();
if (carde.matches("")) {
Toast.makeText(getApplicationContext(), getString(R.string.Skan_Udfyld_Kort_Nummer), Toast.LENGTH_SHORT).show();
cardnumberbox.requestFocus();
return;
}
Intent i = new Intent(ScanActivity.this, CameraActivity.class);
i.putExtra("EXTRA_SESSION_ID", carde);
startActivity(i);
}
});
to go to my cam activity so I can take some pictures and go back with
public void btn_aprove2(View view) {
Intent i = new Intent(CameraActivity.this, ScanActivity.class);
String counts = count.getText().toString().trim();
i.putExtra("EXTRA_SESSION_IDs", counts);
String carde = cardnumberbox2.getText().toString().trim();
i.putExtra("EXTRA_SESSION_ID", carde);
startActivity(i);
finish();
to the scanneractivity again. My scanner does not work properly but if I then press the back button it does go back to the scanneractivity again instead of my menu so it seems like the scanneractivity is running twice and only 1 of them are functional but is here where it confuses me
cause if do not press the btn_aprove2
button and just use the back button instead
i gets the exact same issue but here my scanneractivity is not runned twice as when i press the back button it just takes me back to the menu
a video of the issue
by removing my screen orientation from the manifest (so i can rotate it) my scanner do now work but only if i first rotate to landscape and rotate it back to potrait
and i see in the log is that it is only calling the oncreate when rotating and only on resume and pause on the button's(startactivity/finnish)
I am totally lost on how to get this to work.
on github with api demo and documentation in the wiki and with thoose classes that are being used
If you just jump to the Camera activity to get some data, I'd recommend you to start the activity for a result (startActivityForResult) without finishing the Scanner activity at all. This would give you a proper working back stack (using back button to go back from Camera to Scanner).
Besides that why are you using i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
? You are starting a new activity and finishing the old one. I don't see why this flag is really needed. What is your android:launchMode
in your manifest and are you sure you know what FLAG_ACTIVITY_NEW_TASK
is doing and it is what you want?
Anyways from what you told us it looks like your example really should utilize startActivityForResult()
without calling finish()
:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With