Here are the examples of the java api class android.support.test.espresso.contrib.CountingIdlingResource taken from open source projects.
1. QuizActivity#onCreate()
Project: android-topeka
File: QuizActivity.java
File: QuizActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mCountingIdlingResource = new CountingIdlingResource("Quiz"); String categoryId = getIntent().getStringExtra(Category.TAG); mInterpolator = new FastOutSlowInInterpolator(); if (null != savedInstanceState) { mSavedStateIsPlaying = savedInstanceState.getBoolean(STATE_IS_PLAYING); } super.onCreate(savedInstanceState); populate(categoryId); int categoryNameTextSize = getResources().getDimensionPixelSize(R.dimen.category_item_text_size); int paddingStart = getResources().getDimensionPixelSize(R.dimen.spacing_double); final int startDelay = getResources().getInteger(R.integer.toolbar_transition_duration); ActivityCompat.setEnterSharedElementCallback(this, new TextSharedElementCallback(categoryNameTextSize, paddingStart) { @Override public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { super.onSharedElementStart(sharedElementNames, sharedElements, sharedElementSnapshots); mToolbarBack.setScaleX(0f); mToolbarBack.setScaleY(0f); } @Override public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots); // Make sure to perform this animation after the transition has ended. ViewCompat.animate(mToolbarBack).setStartDelay(startDelay).scaleX(1f).scaleY(1f).alpha(1f); } }); }