CopyPastor

Detecting plagiarism made easy.

Score: 0.8035510576971744; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2023-01-09
by Mubarak Ansari

Original Post

Original - Posted on 2015-05-20
by blade



            
Present in both answers; Present only in the new answer; Present only in the old answer;

You Can also create your own custom click action like this : fun customActionClickOnItemEvent( @NonNull targetViewId: Int ): ViewAction { return object : ViewAction { val click = ViewActions.click() override fun getDescription(): String = "Item clicked" override fun getConstraints(): Matcher<View> = click.constraints override fun perform(uiController: UiController?, view: View?) { click.perform(uiController,view?.findViewById(targetViewId)) } } } And Calling this function like this : onView(withId(R.id.rv_products)).perform( RecyclerViewActions.actionOnItemAtPosition<RecyclerView.ViewHolder>( 1, customActionClickOnItemEvent(R.id.img_wish_list) ) )
You can do it with customize view action.
public class MyViewAction { public static ViewAction clickChildViewWithId(final int id) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return null; }
@Override public String getDescription() { return "Click on a child view with specified id."; }
@Override public void perform(UiController uiController, View view) { View v = view.findViewById(id); v.performClick(); } }; }
}
Then you can click it with
onView(withId(R.id.rv_conference_list)).perform( RecyclerViewActions.actionOnItemAtPosition(0, MyViewAction.clickChildViewWithId(R.id. bt_deliver)));

        
Present in both answers; Present only in the new answer; Present only in the old answer;