Reputation: 5025
Please, give me a hint how to solve this situation:
I have two custom views in my Activity and I'd like to call an Activity method after clicking a button in one of custom views (Y).
I can get the X view from parent Acitivity by findViewById()
and call it's public method. But how can I let the parent Acitivy know that the button was pressed?
Do I have to pass Activity reference to view Y to call an Activity method from OnClickListener?
Thank you!
Upvotes: 0
Views: 2236
Reputation: 15847
button = (Button)customviewY.findViewById(R.id.btnClick);
button.setOnClickListener(new OnClick..(){
onClick(View v)
{
textView= (TextView)customviewY.findViewById(R.id.txtView);
textView.setText("");
}
});
Upvotes: 2