Java tutorial
//package com.java2s; import android.content.*; import android.os.Build; import android.webkit.WebView; import java.util.*; public class Main { private static String h = null; private static String i(Context context) { if (h == null) { String s = (new WebView(context)).getSettings().getUserAgentString(); if (s == null || s.length() == 0 || s.equals("Java0")) { String s1 = System.getProperty("os.name", "Linux"); String s2 = (new StringBuilder()).append("Android ").append(android.os.Build.VERSION.RELEASE) .toString(); Locale locale = Locale.getDefault(); String s3 = locale.getLanguage().toLowerCase(); if (s3.length() == 0) s3 = "en"; String s4 = locale.getCountry().toLowerCase(); String s5; String s6; if (s4.length() > 0) s5 = (new StringBuilder()).append(s3).append("-").append(s4).toString(); else s5 = s3; s6 = (new StringBuilder()).append(Build.MODEL).append(" Build/").append(Build.ID).toString(); s = (new StringBuilder()).append("Mozilla/5.0 (").append(s1).append("; U; ").append(s2).append("; ") .append(s5).append("; ").append(s6).append(") AppleWebKit/0.0 (KHTML, like ") .append("Gecko) Version/0.0 Mobile Safari/0.0").toString(); } h = (new StringBuilder()).append(s).append(" (Mobile; ").append("afma-sdk-a-v").append("4.1.0") .append(")").toString(); } return h; } }