I add my custom View‘s dynamically but I don’t know how to set click listeners for them.
My code:
rect1.setOnClickListener(new OnClickListener(){
public void onClick(View v){
frame_view.addView(new CustomView(getApplicationContext())
.setOnLongClickListener(listener);
}
});
rect1 = my button.
Eclipse underlines addView and shows this error:
The method addView(View) in the type ViewGroup is not applicable for the arguments (void)
1 Answer