I'm developing an android app using android studio. I implemented web3j and successfully connected to ethereum using infura. I'm not sure how I can get the total supply of a specific coin.
Tried using the load method to load a specific tokens contract but was not able to get that to work.
Instead of using RPC nodes like Infura, I recommend that you use Moralis as it provides you with an easy API that you can call in Java. It's a basic REST API so you can call it in any other language too.
You can use this
runContractFunctionAPI here. And all you need to do is provide the input parameters as follows:address: ERC20 token contract addresschain: the chain your ERC20 token existsfunction_name:totalSupplyabi: the ABI of ERC20 tokenOnce you have all this setup, you'll be able to get the total supply in just a few lines of code.
Hope this helps out! :