Results 1 to 2 of 2
  1. #1
    stewypost is offline Member
    Join Date
    Feb 2014
    Posts
    1
    Rep Power
    0

    Default multiple buttons to send predefined SMS

    Hi guys i am new to programming. I am trying to have multiple button to send different predefined SMS to predefined number. I am not sure how to have multiple setOnClickListener(new OnClickListener() as the 2nd setOnClickListener(new OnClickListener() gave me error.

    #8730409 - Pastie

    Sorry forgot to mention I am doing this on Java Android programming
    Thank you!
    Last edited by stewypost; 02-13-2014 at 07:49 PM.

  2. #2
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Posts
    203
    Rep Power
    0

    Default Re: multiple buttons to send predefined SMS

    Well, you shouldn't have to have multiple. I am not familiar with Android dev, but it could look something like this:

    Java Code:
    public class ClickListener extends OnClickListener {
    
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.buttonSend:
                    //Send SMS one
                    break;
    
                case R.id.buttonSend2:
                    //Send SMS two
                    break;
            }
        }
    }
    Then you could do something like this:
    Java Code:
    OnClickListener listen = new ClickListener();
    buttonSend.setOnClickListener(listen);
    buttonSend2.setOnClickListener(listen);
    1000011 1100001 1101110 100000 1111001 1101111 1110101 100000 1110010 1100101 1100001 1100100 100000 1000010 1101001 1101110 1100001 1110010 1111001 111111

Similar Threads

  1. Easier way of creating multiple buttons
    By alexix in forum New To Java
    Replies: 6
    Last Post: 04-21-2013, 01:54 PM
  2. Best Way to Run a method on multiple buttons
    By Dcalladi in forum New To Java
    Replies: 1
    Last Post: 11-07-2011, 04:45 AM
  3. multiple submit buttons on webpage
    By samanthamaryhorgan in forum Advanced Java
    Replies: 1
    Last Post: 03-04-2010, 03:51 AM
  4. multiple submit buttons on webpage
    By samanthamaryhorgan in forum New To Java
    Replies: 0
    Last Post: 03-04-2010, 02:19 AM
  5. One controller with multiple buttons and colors
    By Cutter in forum New To Java
    Replies: 5
    Last Post: 01-24-2010, 07:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •