https://web3j.readthedocs.io/en/latest/command_line.html
https://web3j.readthedocs.io/en/latest/smart_contracts.html#solidity-smart-contract-wrappers
Example
public class MainActivity extends AppCompatActivity {
private final String msContractAddr = "0x0101010101010101010101010101010101010101";
private final String msPrikey = "0x0000000000000000000000000000000000000000000000000000000000000000";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Credentials credentials = Credentials.create(msPrikey);
Web3j web3 = Web3jFactory.build(new HttpService("https://rinkeby.infura.io/your-api-key"));
Handler handler = new Handler();
handler.post(new Runnable() {
@Override
public void run() {
new Thread() {
@Override
public void run() {
try {
// call your contract here
// http calls should be run on a different thread
} catch (Exception e) {
e.toString();
}
}
}.start();
}
});
}
}