I have a ListView in a XML layout but I want to override one of the methods. Is this possible?
this.setContentView(R.layout.my_view);
ListView lv = (ListView) this.findViewById(R.id.lstIngrSelect);
Now say I want to override a method of lv. How can I do that, if possible?
You should create a subclass of ListView ("MyListView") and override the OnFilterComplete method there. Then, in your layout xml, (fully) reference your class -- com.my.company.MyListView -- instead of ListView. Use your class name in the code as well:
MyListView lv = (MyListView) this.findViewById(R.id.lstIngrSelect);
The resulting object should act identically to a regular listview except for your custom code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.