I have created custom Preference dialog from answer of this link.
Now I want click event on that button in my ActivityPreferenceScreen
activity class.
How can i achieve this ?
I have created custom Preference dialog from answer of this link.
Now I want click event on that button in my ActivityPreferenceScreen
activity class.
How can i achieve this ?
Add the following attribute in your Activity
:
OnClickListener prefButtonListener = new OnClickListener() {
public void onClick(View view)
{
Log.v("Btn", "Clicked");
}
};
In the place you instanciate the EditTextPreferenceWithButton
class, add this code:
editTextPreferenceWithButton.attachButtonListener(prefButtonListener);
And then, add following in your EditTextPreferenceWithButton
class :
public void attachButtonListener(OnClickListener listener) {
this.button.setOnClickListener(listener);
}
}