Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ViewContract {
- void setupContentList(ArrayList<MyModel> list);
- }
- public interface PresenterContract {
- void onViewCreated();
- }
- public class MainActivity extends Activity implements ViewContract {
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- ......
- mListView = findViewById(R.id.listview);
- mPresenter.onViewCreated();
- }
- public void setupContentList(ArrayList<MyModel> list) {
- MyAdapter adapter = new MyAdapter<MyModel>(this, R.layout.list_item, items);
- mListView.setAdapter(adapter);
- }
- }
- public class Presenter implements PresenterContract {
- public Presenter() {
- ArrayList<MyModel> mItems = new ArrayList();
- // Add items to the list
- }
- public void onViewCreated() {
- mView.setupContentList(mItems);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement