Question

I created a custom View Round button which consists of an image and some text. I tried to bind a method to it but it doesn't work and don't know what could be the reason.

In the main.xml (layout file) i set the parameter clickable to true and in the onCreate method in the main activity i added the following lines:

rbActionButton = (RoundButton)findViewById(R.id.actionButton);

    rbActionButton.setOnClickListener(new OnClickListener(){
        public void onClick(View view){
            onActionButton();
        }
    });

Does anyone know whether there's anything missing or the reason it doesn't work?

Thanks!

Was it helpful?

Solution

Yes this doesnot work because you need key listener but you are trying with ClickListener.

http://developer.android.com/reference/android/text/method/KeyListener.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top