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
> ActivityInstrumentationTestCase2<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