There is a popupwindow in the activity.
When you want to set a checbox Click Event in getview of the adapter, this popupwindow is displayed and hidden.
However, because the adapter and activity are not the same class, the operation is a little troublesome ..
-------------------------- Split line --------------------------------------------
Class: the adapter inherits the baseadapter
Class: The activity inherits the activity
------------------------------ In the adapter --------------------------
Weakreference <activity> weak; // defines weak reference variables.
Public adapter (context ){
This. Weak = new weakreference <activity> (activity) context );
........
}
In the getview Method
In the checkbox listener
Final atistmactivity = weak. Get ();
Activity. **(); /// // The method in the activity is called here ////////////////////////////
------------------------------------------- The preceding method is always used, but it is too complicated. I have heard from others these days that there is another simpler method ----------------------
The red code is the part of the call.
Activity:
Public class myactivity extends Activity
{
Public void test (){};
Public void test (INT position ){}
}
Baseadater:
Public class mybaseadapter extends baseadapter {
Myactivity context;
Public mybaseadapter (MyactivityContext ){
This. Context = context;
}
// Call the myactivity method in other functions.
Context. Test ();
Context. Text (1 );
}