The easiest way to get a click event from the button is by registering an
OnClick listener:
http://developer.android.com/reference/android/view/View.html#setOnClickListener(android.view.View.OnClickListener)

Then, your handler should probably send the motor command. Unless you
specify how your motor is connected to the IOIO, I can't answer what this
code would look like.


On Thu, Jan 15, 2015 at 7:13 AM, Cesar Quiroz <[email protected]> wrote:

> Hello folks!
>
> I want to use a button that when pressed, the motor begin to work, and
> just stop when i release the button.
> I'm trying with the following programmation:
>
> yourbutton.setOnTouchListener(new OnTouchListener(){
>     @Override
>     public boolean onTouch(View v, MotionEvent event)
>     {
>         if(event.getAction() == MotionEvent.ACTION_DOWN)
>         {
>             ((Button) v).setPressed(true);
>             //TODO: Add the code of your onClick-event here
>         }
>         return true;//Return true, so there will be no onClick-event
>     }});
>
> Somebody can to help me?
>
>
> Thanks! ;D
>
>  --
> You received this message because you are subscribed to the Google Groups
> "ioio-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/ioio-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to