Code to create button in Preference Screen | Techbirds

As we know we have EditText Preference, CheckBox Preference but we don’t have any Button Preference. Here we discuss How to use Preference as a Button.

Then for the java in your onCreate()

Preference button = (Preference)findPreference(“button”); button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference arg0) { //code for what you want it to do return true; }

});

551 total views, 1 views today

Share this Onfacebook-9287122twitter-2614318linkedin-4197145google-1286829