Code to create button in Preference Screen | Techbirds
Posted on: September 4, 2017 /
Categories: Mobile Applications
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 On