2017-02-16 48 views

回答

1

我會做這樣的:

@Rule 
public ActivityTestRule<MyClass> activityRule = new ActivityTestRule(MyActivity.class); 

@Test 
public void myTest() { 
    RecyclerView recyclerView = activityRule.getActivity().findViewById(R.id.my_recyclerview) 
    int itemCount = recyclerView.getAdapter().getItemCount(); 
} 
相關問題