If I was not mistaken, with transactioninput.getConnectedOutput(), the output which is used for the input is obtained.
But what to do later? There seem to be two relevant methods: getAddressFromP2PKHScript(NetworkParameters networkParameters) and getAddressFromP2SH(NetworkParameters networkParameters). Am I correct that either one of them will give me the correct address?
Also how to obtain the addresses involved in multisignature transaction with bitcoinj?