There are two activations. From the first turn to the second, the first finish. And from the second I turn to the first, but the peculiarity is that when you press the same button in the first activation, it should finish (not create the second, as in the first case). I have the idea to transfer to the Intent any key, and check its presence in the first activation. How can this be implemented? If you use such code, the program crashes with java.lang.NullPointerException
boolean prev = getIntent().getExtras().getBoolean("prev", false); if (!prev){ mContext.startActivity(intent); }