When you override methods, make sure to call their super.

Anyway, why do you want to use a touch listener on a button? You're
going to get tons of motion events each time the user touches the
button or simply slide its finger on it.

R/

On Sat, May 2, 2009 at 4:12 AM, Mariam Rady <mariam.r...@gmail.com> wrote:
>
> Hi everyone,
> I'm trying to add an OnClickListener and an OnTouchListener on a
> button. However when I add the OnClickListener on the button it works.
> Whenever I add the OnTouchListener to the button with the
> OnCLickListener, none of them works. Here is the code:
>
>                        final Button a=new Button(this);
>                        a.setLayoutParams(new AbsoluteLayout.LayoutParams
> (-2,-2,lastxposition,lastyposition));
>                        a.setText("Button");
>
>                        a.setOnClickListener(new View.OnClickListener()
>                        {
>                               �...@override
>                        public void onClick(View v) {
>                                                          openFiles
> ();
>                                        }
>
>                        });
>
>                        a.setOnTouchListener(new View.OnTouchListener()
>                                 {
>                       �...@override
>                        public boolean onTouch(View v, MotionEvent event) {
>                        String tagname=(String) a.getText();
>                        findID(tagname);
>                        return true;
>                                        }
>
>                                });
>
> Can anybody tell me what I do wrong here?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to