Returns true if system is Android - Android java.lang

Android examples for java.lang:System

Description

Returns true if system is Android

Demo Code

import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Vector;

public class Main{

    /**/*from  w w w . j  a va2s .co m*/
     * Returns true if system is Android
     * @return true if system is Android
     */
    public static boolean isAndroid() {

        String userHome = System.getProperty("user.home");
        String vendorUrl = System.getProperty("java.vendor.url");

        if (userHome.isEmpty() || vendorUrl.contains("www.android.com")) {
            return true;
        } else {
            return false;
        }

    }

}

Related Tutorials