How do you implement multiple View's for the same presenter

145 views
Skip to first unread message

Carl

unread,
Apr 1, 2010, 5:53:50 AM4/1/10
to Mvp4g
Hi

I am trying to write multiple view's for the same presenter,
i.e. When the page is viewed in IE, view_1 gets loaded,
when IPhone views page view_2 gets loaded.

Thanks

Pierre

unread,
Apr 1, 2010, 7:58:36 AM4/1/10
to Mvp4g
Here is one way you can do it:

public interface IView {

public IBaseView buildIEView();

public IBaseView buildIPhoneView();

}

public class MyPresenter extends BasePresenter<IView,...>{

private IBaseView presenterView;

private void bindView(){
if(isIE()){
presenterView = view.buildIEView();
}
else{
presenterView = view.buildIPhoneView();
}

}

//for the rest of your event, use presenterView

Reply all
Reply to author
Forward
0 new messages