Hello

I have trouble to define more than one OnClickListener in one
Activity. I have set breakpoints on each of the onClick method in the
listeners, and if I define more than one (such as in the code below)
non of the breakpoints get reached. However, if there is just one
listener define, it works ok. I know that it should work, because I
have seen applications using similar code. Any ideas on whats wrong
here are greatly appreciated :)

---Code---
package ch.android.CallButler;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class CallButler extends Activity {

        private Button bConfig;
        private Button bStart;
        private Button bExit;

    protected OnClickListener bConfigListener = new OnClickListener()
{ public void onClick(View v) {
           // initiate a new sub activity ... startActivity for the
moment...
            Intent i = new Intent(CallButler.this, Configure.class);
            startActivity(i);
    } };

    protected OnClickListener bStartListener = new OnClickListener()
    { public void onClick(View v) { } };

    protected OnClickListener bExitListener = new OnClickListener()
    { public void onClick(View v) { } };

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);

        // Set the OnClickListeners
        this.bConfig = (Button) findViewById(R.id.config);
        this.bConfig.setOnClickListener(this.bConfigListener);

        this.bStart = (Button) findViewById(R.id.start);
        this.bConfig.setOnClickListener(this.bStartListener);

        this.bExit = (Button) findViewById(R.id.exit);
        this. bConfig.setOnClickListener(this.bExitListener);
    }
}
---End Code--
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to