Incompatibility with Android #19

Changes made to the java part to be compatible with Android