Android Question [SOLVED] Close an activity and open another

Vinians2006

Active Member
Licensed User
I guys! Im using StartActivity(Another) to open an Activity called "Another", then when I need to go back to Main activity Im using StartActivity(Main), but the problem is when user push back key the android returns to "Another" activity. There are any way to really close an activity?
Thanks!
 

Rob Rendle

Member
Licensed User
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then startactivity (Main)
End Sub
 

Vinians2006

Active Member
Licensed User
Hey friend, thanks, but its not what I need. I need to know if I can Unload "Another" activity after I use it, like wipe it from memory so that back button cannot return to it again.
 
Top