java Version - Android Android OS

Android examples for Android OS:OS Build

Description

java Version

Demo Code


//package com.java2s;
import java.util.zip.Deflater;

public class Main {
    private static int javaVersion0() {
        try {//from w w w.  j a va2 s .c  o m
            // Check if its android, if so handle it the same way as java6.
            //
            // See https://github.com/netty/netty/issues/282
            Class.forName("android.app.Application");
            return 6;
        } catch (ClassNotFoundException e) {
            //Ignore
        }

        try {
            Deflater.class.getDeclaredField("SYNC_FLUSH");
            return 7;
        } catch (Exception e) {
            // Ignore
        }

        try {
            Double.class.getDeclaredField("MIN_NORMAL");
            return 6;
        } catch (Exception e) {
            // Ignore
        }

        return 5;
    }
}

Related Tutorials