Hi.

If I understood your intentions correctly you should set
OnLongClickListener.
Button button = (Button) findViewById(R.id.*channel_up*);

button.setOnFocusChangeListener(new View.OnLongClickListener()
                        {
                                public boolean onLongClick(View view)
                                {
                                        return false;
                                }
                        });

method onLongClick in this anonymous class will be called when user
presses and holds "cannnel_up" button for about 2 seconds

On 2 окт, 03:08, Shude Zheng <sh...@excelfore.com> wrote:
> I want to add some code when user press and hold the button. I try use
> change the focus function. I wrote the similar code like onClick. But it was
> never called when I moved curer to button and it was focused.
>
> Button button = (Button) findViewById(R.id.*channel_up*);
>
> button.setOnFocusChangeListener(*new* Button.OnFocusChangeListener() {
>
> *public* *void* onFocusChange(View v, *boolean* hasFocus) {
>
> }
>
> Thanks
>
> Shude

--~--~---------~--~----~------------~-------~--~----~
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