0

I am working on stripe-terminal-android-app, to connect to BBPOS 2X Reader device,

wanted to click-item from list,(recyclerView).

I am trying to do:

when list of devices appears(readers), I am checking if readers.size()==1, then click first-device from list,else show recyclerView();

I have very less experience in Android(coming from JS, PY), :)

After going through debugger to understand flow of program-running, I used F8 key, or stepOver the functions one by one,

and where value is assigned to convert in displayble-format in adapter as here.

public ReaderAdapter(@NotNull DiscoveryViewModel viewModel) {
    super();
    this.viewModel = viewModel;
    if (viewModel.readers.getValue() == null) {
        readers = new ArrayList<>();
    } else {
        readers = viewModel.readers.getValue();
        if(readers.size() == 1){
            Log.e(TAG, "readers.size() is 1 "+ readers.size());
        }

    }
}

then in ReaderHolder-file, values are bind() as

    void bind(@NotNull Reader reader) {
        binding.setItem(reader);
        binding.setHandler(clickListener);
        binding.executePendingBindings();
    }
}

I tried assigining button and manually clicking when only-one device appears, by clicing on reader[0], can't do that by findViewById inside Adapter file, to call onClick() method manually,

I tired another StackOverflow's answer but didn't understood, from here.

Main fragment is discovery-fragment,

how can I click first-device by checking readers.size()==1, then click onClick()?

my final-goal is to automate, whole stripe-terminal-payment process on android.

extra-info:

I am fetching data from python-odoo server, then using url, will open app through browser, (done this part), then device will be selected automatically as everytime-no any devices will be present except one,

so will automatically select that from recyclerView, then proceed.

I have asked for help in detailed way on GitHub-issues, and started learning Android's concepts for this app(by customizing stripe's demo app, which works great, but I wanted to avoid manually clicking/selection of devices).

GD- Ganesh Deshmukh
  • 1,456
  • 3
  • 24
  • 36
  • I previously had error of path-prefix, which got me a week, which was working in postman, but not in android, because of not appending `/` at end of url-route. stripe-support team is great, but they also could not figured-it-out, but helped me a lot on call, chat, email. that issue was https://github.com/stripe/stripe-terminal-android/issues/77 – GD- Ganesh Deshmukh Nov 12 '19 at 20:05
  • My final-demo(expected) is detailed here on Github-Issues(though it's not issue, but needed help to solve it) https://github.com/stripe/stripe-terminal-android/issues/78 – GD- Ganesh Deshmukh Nov 12 '19 at 20:07
  • [check this for more information](https://stackoverflow.com/a/24471410/9880917) – dinesh reddy Nov 13 '19 at 06:43
  • ok @dinesh, will check it out. – GD- Ganesh Deshmukh Nov 13 '19 at 06:48
  • @dineshreddy, can I get you a call? I need urgent help, but can't figure it out by myself. – GD- Ganesh Deshmukh Nov 13 '19 at 06:56

0 Answers0