e(TAG,<span class="string">"settings:------------->"</span><span> + dect_state); </span></span></li><li><span> } </span></li><li><span> } </span></li><li><span> </span></li><li><span> <span class="annotation">@Override</span><span> </span></span></li><li><span> <span class="keyword">public</span><span> </span><span class="keyword">boolean</span><span> onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { </span></span></li><li><span> <span class="keyword">if</span><span> (preference == mButtonDect ) { </span></span></li><li><span> </span></li><li><span> <span class="keyword">int</span><span> dect = mButtonDect.isChecked() ? </span><span class="number">1</span><span> : </span><span class="number">0</span><span>; </span></span></li><li><span> <span class="keyword">boolean</span><span> state; </span></span></li><li><span> <span class="keyword">if</span><span>(dect == </span><span class="number">1</span><span>) </span></span></li><li><span> state = <span class="keyword">true</span><span>; </span></span></li><li><span> <span class="keyword">else</span><span> </span></span></li><li><span> state = <span class="keyword">false</span><span>; </span></span></li><li><span> <span class="keyword">try</span><span>{ </span></span></li><li><span> midphoneservice = IMidPhoneService.Stub.asInterface(ServiceManager.getService(<span class="string">"midphone"</span><span>)); </span></span></li><li><span> Settings.System.putInt(getContentResolver(), </span></li><li><span> Settings.System.DECT_SAVED_STATE,dect); </span></li><li><span> midphoneservice.setDectEnabled(state); </span></li><li><span> </span></li><li><span> Log.e(TAG,<span class="string">"settings:------------->"</span><span> + dect); </span></span></li><li><span> } <span class="keyword">catch</span><span> (RemoteException e) { </span></span></li><li><span> e.printStackTrace(); </span></li><li><span> } </span></li><li><span> <span class="keyword">return</span><span> </span><span class="keyword">true</span><span>; </span></span></li><li><span> } </span></li><li><span> <span class="keyword">return</span><span> </span><span class="keyword">false</span><span>; </span></span></li><li><span> } </span></li><li><span> </span></li><li><span> <span class="annotation">@Override</span><span> </span></span></li><li><span> <span class="keyword">protected</span><span> </span><span class="keyword">void</span><span> onResume() { </span></span></li><li><span> <span class="keyword">super</span><span>.onResume(); </span></span></li><li><span> </span></li><li><span> <span class="keyword">if</span><span> (mButtonDect != </span><span class="keyword">null</span><span>) { </span></span></li><li><span> mButtonDect.setChecked(Settings.System.getInt( </span></li><li><span> getContentResolver(), </span></li><li><span> Settings.System.DECT_SAVED_STATE, <span class="number">1</span><span>) != </span><span class="number">0</span><span>); </span></span></li><li><span> } </span></li><li><span> } </span></li><li><span>} </span></li></ol></div><pre class="java" name="code" style="display: none; " codeable_id="1420761" codeable_type="Blog" source_url="http://koliy.
Back to home |
File page
Subscribe |
Register |
Login
| N