Destroy an Intent?
android
Solution
You can prevent the user from going on to the previous `Activity` by overriding the back key functionality like this:
public void onBackPressed() {
//doing nothing on pressing Back key
return;
}
Though this approach is not encouraged.And as everybody knows, the `Activity` will be automatically killed when certain aspects come up like memory requirement. You cannot destroy one `Activity` at your free will.
Though for specific cases like a welcome splash screen maybe, you can do one of the following two things:
1) call `finish()` method on your current `Activity` as you move onto your new `Activity`(generally done when using `Thread`).
2) use the following in your `manifest`:
<activity android:name=".WelcomeScreen" android:noHistory="true" ... />
This will tell the device to not keep this `Activity` on the `Activity` stack.
Problem
When I create a Intent: ``` Intent in = new Intent(this, myclass.class); this.startActivity(in); ``` I create a new Intent but the last Intent is not destroy It's still in memory How can I kill this last destroy? So I want to create two Intents in two different classes: in the first class I write this: ``` Intent in1 = new Intent(this, myclass2.class); this.startActivity(in); ``` and in second class I write this: ``` Intent in2 = new Intent(this, myclass1.class); this.startActivity(in2); ``` but when I Click in1 will create and the in2 will destroy, and when i Click on in2 the in2 will create and in1 will destroy. a want to clean my phone memory.