What is the difference between transactioninput.getFromAddress() and transactioninput.getConnectedOutput().getAddressFromP2SH(networkparameter))? I was expecting that, in the case when getFromAddress() returns an address,
transactioninput.getConnectedOutput().getAddressFromP2SH(networkparameter)) should return the same address. But, sometimes  transactioninput.getConnectedOutput() returns a null value, despite getFromAddress() returning a proper address. What is the reason?

If these two methods are different, how could I return the value of field "addr" of the object "prev_out" of the items in the array "input" in the JSON object returned without the use of blockchain.info-api? (for example, for this https://blockchain.info/address/1LoD9DeUeCfnZueSVPzFaFkfFcx8mG1Add?format=json).
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.