Back to project page Android-Apps.
The source code is released under:
Apache License
If you think the Android project Android-Apps listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.kniezrec.voiceremotefree; /* ww w . j a v a 2 s. c o m*/ import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceActivity; import android.view.MenuItem; import android.widget.Toast; public class SettingsActivity extends PreferenceActivity { private Preference portPref; private ListPreference senderFactoryPref; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_general); portPref = findPreference(MainActivity.PREFS_SERVER_PORT_KEY); senderFactoryPref = (ListPreference) findPreference(MainActivity.PREFS_SENDER_FACTORY_KEY); senderFactoryPref .setOnPreferenceChangeListener(new OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { setPortEnabledState(newValue); return true; } }); getActionBar().setDisplayHomeAsUpEnabled(true); getListView().setBackgroundResource(R.drawable.bacg); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: super.onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } } private void setPortEnabledState(Object keyCodeSenderFactory) { boolean portEnabled = keyCodeSenderFactory .equals(BSeriesKeyCodeSenderFactory.class.getCanonicalName()); portPref.setEnabled(portEnabled); if (portEnabled) { Toast.makeText(this, R.string.b_series_info, Toast.LENGTH_LONG) .show(); } } }