It looks like I need to bind the event listeners to on the

onFinishInflate of my compound Control. If I move the onCLick handler
there, it seems to work


On Nov 25, 3:04 pm, DoubleCheese <[email protected]> wrote:
> Hi,
>
> I've tried to create a simple compound view with an EditTExt and a
> button, but when I try to register a onClickListener on the
> imagebutton it doesn't seem to get called. Here is the code:
>
> This code is in the constructor of my CompoundView which extends
> FrameLayout:
>
> ...
> final View root =
> LayoutInflater.from(getContext()).inflate(R.layout.root_layout, this,
> true);
> setClickable(true);
>
>                 imageButton= (ImageButton) 
> root.findViewById(R.id.btnMyButton);
>                 imageButton.setImageResource(android.R.drawable.ic_btn_icon);
>                 editText = (EditText) root.findViewById(R.id.myEditText);
>
>                 imageButton.setOnClickListener(new OnClickListener() {
>                         @Override
>                         public void onClick(View v) {
>
>                                 Log.i("CompoundView", "Click event was 
> detected.");
>
>                         }
>                 });
>
>         }
>
> I can see the edit text and button but when I click on the button I
> don't see any logs. Anyone know what I need to do to make the
> onClickListsner work?
>
> regards,
> Dennis

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to