public static boolean isAndroidRuntime(){
  final String runtime=System.getProperty("java.runtime.name");
  return runtime != null && runtime.equals("Android Runtime");
}

public static boolean isAndroidRuntime ( ) { final String runtime = System . getProperty ( "java.runtime.name" ) ; return runtime != null && runtime . equals ( "Android Runtime" ) ; }
determine if running on android by inspecting java . runtime . name property .
