Created
August 31, 2012 09:31
-
-
Save esmasui/3550795 to your computer and use it in GitHub Desktop.
ActionBarSherlock4.1でActivituUnitTestCaseがエラーになる件
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.app.Activity; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.test.ActivityUnitTestCase; | |
| public class MainActivityUnitTest extends ActivityUnitTestCase<MainActivity> { | |
| private Intent _startIntent; | |
| public MainActivityUnitTest() { | |
| super(MainActivity.class); | |
| } | |
| @Override | |
| protected void setUp() throws Exception { | |
| super.setUp(); | |
| Context targetContext = getInstrumentation().getTargetContext(); | |
| //Set your theme | |
| targetContext.setTheme(R.style.AppTheme); | |
| setActivityContext(targetContext); | |
| _startIntent = new Intent(Intent.ACTION_MAIN); | |
| } | |
| public void testPreconditions() { | |
| startActivity(_startIntent, null, null); | |
| assertNotNull(getActivity()); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Manifestでtheme設定してる場合。
Activity#onCreate()でsetTheme()してる場合は関係ないです。