How To Call Method From Activity To Change Layout?
How can I call the changeTitle() method of VideoLayout inside the onItemClick event of the activity? I'm trying to figure out what's the best practice to change the content of a li
Solution 1:
@OverridepublicvoidonItemClick(AdapterView<?> parent, View view, int position, long id) {
Viewwrapper= view.findViewById(R.id.wrapper);
if(wrapper != null && wrapper instanceof VideoLayout) {
wrapper.changeTitle("title");
}
}
Solution 2:
Solved!
I've simplified it (based on @thinear's answer):
@OverridepublicvoidonItemClick(AdapterView<?> av, View v, int position,
long id) {
VideoLayoutwrapper= (VideoLayout) v.findViewById(R.id.wrapper);
wrapper.changeTitle("title");
}
Post a Comment for "How To Call Method From Activity To Change Layout?"