I am working on stripe-terminal-android app
, they have built-in app, but I wanted to customise it according to use-case.
link of stripe-app-repo
when I open app it first gives me fragment, to Discover Readers
, link-of-code,
but I wanted that to automatically clicked and without any click it should work as it was clicked, so that no need to manually Discover-Readers, everytime.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.discover_button).setOnClickListener(v -> {
final FragmentActivity activity = getActivity();
if (activity instanceof NavigationListener) {
((NavigationListener) activity).onRequestDiscovery(viewModel.getSimulated());
}
});
but, current code is to call onRequestDiscovery
, is executed only after clicking-button, how can I do like we do in javascript?
document.getElementById("demo").click())
or similar-one? so no need to manually-click and it would proceed further.
Edit after answer by Sebastein.
added this line, but I wanted to click and call function onRequestDiscovery()
which is not working.
view.findViewById(R.id.discover_button).performClick()
screenshot added after edited-response by Sebastein,