Created
June 8, 2015 15:02
-
-
Save mazurio/bfa3e4a77d259ec9e633 to your computer and use it in GitHub Desktop.
Presenter in MVP (Android)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.mazur.presenter; | |
import java.io.Serializable; | |
import io.mazur.view.TestView; | |
public abstract class Presenter<T extends TestView> implements Serializable { | |
/** | |
* Transient is a Java keyword which marks a member variable not to be serialized when it is persisted to streams of bytes. | |
* When an object is transferred through the network, the object needs to be 'serialized'. | |
* Serialization converts the object state to serial bytes. | |
*/ | |
protected transient T mView; | |
public void onCreateView(T view) { | |
mView = view; | |
} | |
public void onRestoreView(T view) { | |
mView = view; | |
} | |
public T getView() { | |
return mView; | |
} | |
public boolean isViewNotNull() { | |
if(mView == null) { | |
return false; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment