Closed flaviusdemian closed 10 years ago
Can anyone help?
Sorry for the delay. I have to fix my gmail account to receive notifications from github... When you use the constructor with a layout id, like the first line, you are already inflating and creating a view inside the popover view.
What you are doing is: 1: You are creating a popover view for a layout resource, this instantiates internally the FIRST view inside the popover view 2: You are inflating a SECOND view and adding the listener for the SECOND view only, after that, the view is lost 3: You then show the FIRST view, with the button without an onClickListener
What you HAVE to do:
Using your code:
//First create popover view reference
View popoverViewReference = getLayoutInflater().inflate(R.layout.popover_showed_view, null);
if( popoverViewReference != null)
{
btn_popoverSearch = (Button) popoverViewReference.findViewById(R.id.btn_test);
btn_popoverSearch.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
//handler code here
}
});
}
//Second, create the popover view with the view you just created
PopoverView popoverView = new PopoverView(this, popoverViewReference);
popoverView.setContentSizeForViewInPopover(new Point(320, 340));
popoverView.setDelegate(this);
//Finally, present the popover view
popoverView.showPopoverFromRectInViewGroup(rootView, PopoverView.getFrameForView(v), PopoverView.PopoverArrowDirectionAny, true);
Please tell me if this helps, to close this issue.
I'll take a look in the week-end but probably it will be ok, Thanks.
It works, thank you very much.
On Wednesday, November 27, 2013 3:28 PM, Daniel Lupiañez Casares notifications@github.com wrote:
Sorry for the delay. I have to fix my gmail account to receive notifications from github... When you use the constructor with a layout id, like the first line, you are already inflating and creating a view inside the popover view. What you are doing is: 1: You are creating a popover view for a layout resource, this instantiates internally the FIRST view inside the popover view 2: You are inflating a SECOND view and adding the listener for the SECOND view only, after that, the view is lost 3: You then show the FIRST view, with the button without an onClickListener What you HAVE to do:
Hy,
RelativeLayout rootView = (RelativeLayout)findViewById(R.id.rootLayout);
The btn_popoverSearch is found and is not null but the event handler is not called. Any suggestions? Thanks a lot.