I was checking the J2ME login demo and I was thinking where would be the best place and how to unload the views that are not needed.
Lets say my project is really heavy for mobile phones and I want to unload last view and its data when a new view is loaded.
To be clearer, Lets see the PrepViewCommand which creates the instances of MainScreenView before login in successful.
public class PrepViewCommand extends SimpleCommand implements ICommand
{
public void execute(INotification notification)
{
this.facade.registerMediator(new SplashScreenMediator());
this.facade.registerMediator(new LoginScreenMediator());
this.facade.registerMediator(new MainScreenMediator());
}
}
Lets say I dont want to create MainScreenMediator before login is successful and after login is done I dont want to keep LoginScreenMediator in memory which keeps LoginScreen as its member.
What should be the best practice to do so?
I hope I managed to make my question clear
Mazed