hi ira han, in order to provide the action to the check box u need to provide the action listners
oncheckedchange *listener* i tink u need to provide action to the check box r8 it will work we have different approaches as well On Thu, May 24, 2012 at 3:01 PM, imran ali <[email protected]> wrote: > Hi, > guess you are using PreferenceActivity. > so, check your xml, what have you given android:defaultValue="?", either > true or false? > > Hope it will help you. > > > Regards > Imran Ali > > > On Thursday, May 24, 2012 2:10:36 PM UTC+5:30, Ira.Han wrote: >> >> Hi, >> I'm writing a test app which have a operation of click on the >> CheckBoxPreference, here is my code: >> >> public class MyActivityTest extends >> ActivityInstrumentationTestCas**e2<MyActivity>{ >> ..... >> @UiThreadTest >> public void testEnable() { >> **CheckBoxPreference mMyEnable = >> (CheckBoxPreference)mActivity.**getPreferenceScreen().**findPreference("my_enabled"); >> >> mMyEnable.**setChecked(false); >> Log.v(TAG, >> "=======================1=====**========isChecked:"+mMyEnable.**isChecked()); >> >> mMyEnable.**setChecked(false); >> Log.v(TAG, >> "=======================2=====**========isChecked:"+mMyEnable.**isChecked()); >> >> wait(**4); >> } >> .... >> } >> >> in logcat, the isChecked value actually changed: >> V/MyAppTest(12589): >> =======================2======**=======isChecked:true >> V/MyAppTest(12589): >> =======================2======**=======isChecked:false >> >> However on GUI, this checkbox not be clicked/unclicked... is there >> anyone have some ideas? >> Many thanks >> >> Regards >> Ira > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

