0

作为 android 上的测试实用程序的一部分,我可以访问我的活动中的电话设置,如下所示:

Cursor cursor = getContentResolver().(Uri.parse("content://telephony/carriers"), null, null, null, null);

是否可以通过内容解析器或其他方式访问活动之外的设置。

4

1 回答 1

0

AndroidTestCase 和 ActivityInstrumentationTestCase2 都提供了获取 Context 的方法

安卓测试用例:

getContext();

ActivityInstrumentationTestCase2

getInstrumentation().getContext();

此上下文提供对getContentResolver()被测应用程序的更改权限的访问。

于 2011-04-12T17:33:44.010 回答