What is the difference between transactioninput.getFromAddress() and transactioninput.getConnectedOutput().getAddressFromP2SH(networkparameter))?
After going through bitcoinj API documentation regarding the methods you have asked about, the way you make the second method work, you are supposed to connect the input transaction to get the output from that particular tx. You can go through the link I have given above and report back if required.