Skip to content

Instantly share code, notes, and snippets.

@passsy
Last active July 15, 2018 22:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save passsy/4c2cf0bfd2ef3fe6ac1ee02ce9abceb5 to your computer and use it in GitHub Desktop.
Save passsy/4c2cf0bfd2ef3fe6ac1ee02ce9abceb5 to your computer and use it in GitHub Desktop.
public class HelloWorldActivity
extends TiActivity<HelloWorldPresenter, HelloWorldView>
implements HelloWorldView {
private TextView mOutput;
@NonNull
@Override
public HelloWorldPresenter providePresenter() {
return new HelloWorldPresenter();
}
@Override
public void showText(final String text) {
mOutput.setText(text);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello_world);
mOutput = (TextView) findViewById(R.id.output);
}
}
public class HelloWorldPresenter extends TiPresenter<HelloWorldView> {
@Override
protected void onAttachView(final HelloWorldView view) {
super.onAttachView();
view.showText("Hello World!");
}
}
public interface HelloWorldView extends TiView {
@CallOnMainThread
void showText(final String text);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment