I want to change description in the fullWidthDetailsOverviewRowPresenter
when I click action button
, how to do it? I can change data, however how to refresh the view
?
For example, when I click "BUY$9.99", text in the red box will change.
You need to add this line:
detailsOverviewRow.setItem(newItem);
in your DetailsFragment
, where you may have something like this:
private DetailsOverviewRow detailsOverviewRow; @Override public void onCreate(Bundle savedInstanceState) { ... detailsOverviewRow = new DetailsOverviewRow(oldItem); SectionDetailsPresenter detailsPresenter = new SectionDetailsPresenter(new SectionDetailsDescriptionPresenter()); detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_BUY) { Object newItem = oldItem; newItem.setDescription("new description"); detailsOverviewRow.setItem(newItem); } } }); }
The newItem
is the oldItem
you used to create an instance of DetailsOverviewRow
, but with the description attribute changed.
Once you set a new item for your DetailsOverviewRow
, the description presenter (SectionDetailsDescriptionPresenter
in this sample) will be called again, and it will set the newItem
description attribute in the red box you were asking for.