I am using ethLogFlowable to subscribe to an event and read the args of the event, in my case an address and a uint256 value.

I have followed this answer stackExchangeLink, but I am always getting only one element from topics which is the my-event-hash.

Here is my code:

        MainActivity.web3j.ethLogFlowable(filter).subscribe(log -> {
                System.out.println("Event equal "+log);
             Address arg1 = (Address) FunctionReturnDecoder.decodeIndexedValue(log.getTopics().get(1), new TypeReference<Address>() {});
            System.out.println("----ARG1: "+arg1);


The application crash as log.getTopics contains only one element hash_event

Any idea? please.

  • Can you edit your answer and add the definition of this event from your solidity contract. Commented Jan 20, 2019 at 18:14

1 Answer 1


I tested the code below and it is working now for me. The arguments can be extracted from getParameters as follow:

List<Type> args = FunctionReturnDecoder.decode(
                    log.getData(), my_event.getParameters());
System.out.println("Seller : "+args(0).getValue());
System.out.println("Price  : "+args(1).getValue());

And this is the solidity definition of the event:

 event OfferAccepted (address _seller, uint _price);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.