Poor expression ability, so now I want to explain the meaning of the title:
The itemonclick event is triggered when you click the list item of the listview. After you click it, you can go to page A. If there is a connection in the subitem, you want to go to page B, what should we do. Now I can understand the solution:
There are two methods: rewrite the adapter, and set the onclick event in the element of your sub-item (note that the onclick element is set in XML)
I only used the first method and demonstrated it as follows:
We inherit the base class of the adapter, and then override getview.
@ Suppresswarnings ("unchecked") public view getview (INT position, view convertview, viewgroup parent) {convertview = minflater. inflate (this. resource, null); map item = data. get (position); int COUNT =. length; For (INT I = 0; I <count; I ++) {view v = convertview. findviewbyid (to); BindView (v, item, from);} // The following lines are highlights of view Avatar = convertview. findviewbyid (R. id. row_avatar); // obtain the component if (null! = Avatar) {// judge to save the trouble of avatar. settag (item); // we can use settag to store data and send it to the event triggering avatar. setonclicklistener (avatarclicklistener); // trigger event code to look down} return convertview;} // This is the trigger event. Write private onclicklistener avatarclicklistener = new onclicklistener () as required () {@ suppresswarnings ("unchecked") Public void onclick (view v) {map item = (MAP) v. gettag (); // Do you still remember the above settag? We can obtain intent mintent = new intent (adapterwithhashmap. this. context, myself. class); mintent. putextra ("user_id", item. get ("uid "). tostring (); adapterwithhashmap. this. context. startactivity (mintent );}};