微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.text.TextUtils.SimpleStringSplitter的实例源码

项目:ApkAutoInstaller    文件InstallerUtils.java   
public static boolean isEnableAutoInstall() {
    Context mContext = AutoInstallerContext.getContext();
    SimpleStringSplitter simpleStringSplitter = new SimpleStringSplitter(':');
    if (!SettingsUtil.isAccessibiltiyEnable(mContext)) {
        return false;
    }
    String string = Secure.getString(mContext.getContentResolver(),"enabled_accessibility_services");
    if (string == null) {
        return false;
    }
    simpleStringSplitter.setString(string);
    while (simpleStringSplitter.hasNext()) {
        if (simpleStringSplitter.next().equalsIgnoreCase(
                AutoInstallerContext.getTargetService())) {
            return true;
        }
    }
    return false;
}
项目:LTB-android    文件LTCScraper.java   
void loadStopLocations(String routeNum,HashMap<Integer,LTCStop> stops) throws ScrapeException,IOException {
    StringBuilder builder = new StringBuilder(8192);
    String line;
    URL url;
    HttpURLConnection connection;
    boolean try_proxy = PROXY_ENABLED;
    while (true) {
        try {
            if (try_proxy) {
                url = new URL(String.format(PROXY_BASE + LOCATIONS_PATH,routeNum));
                connection = (HttpURLConnection) url.openConnection();
            } else {
                url = new URL(String.format(LTC_BASE + LOCATIONS_PATH,routeNum));
                connection = (HttpURLConnection) url.openConnection();
            }
            connection.setConnectTimeout(MAXIMUM_FETCH_TIMEOUT);
            connection.setReadTimeout(MAXIMUM_FETCH_TIMEOUT);
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
            int offset = 0;
            String stopData = builder.toString();
            // skip past the crap at the start by finding the 1st asterisk
            for (int i = 0; i < 1; ++i) {
                offset = stopData.indexOf('*',offset) + 1;
            }
            /* get the interesting part,and while we're at it,remove all asterisks
     * so we don't have to deal with them at the start of latitudes later
     */
            String actualStopText = stopData.substring(offset).replace("*","");
            StringSplitter splitter = new SimpleStringSplitter(';');
            splitter.setString(actualStopText);
            for (String stopInfo : splitter) {
                String elems[] = stopInfo.split("\\|");
                if (elems.length == 7) {
                    double latitude = Double.valueOf(elems[0]);
                    double longitude = Double.valueOf(elems[1]);
                    Matcher stopNumMatch = LOCATION_STOP_PATTERN.matcher(elems[4]);
                    if (stopNumMatch.find()) {
                        int stopNum = Integer.valueOf(stopNumMatch.group(1));
                        LTCStop stop = stops.get(stopNum);
                        if (stop != null) {
                            stop.latitude = latitude;
                            stop.longitude = longitude;
                        }
                    }
                }
            }
            connection.disconnect();
            return;
        } catch (SocketException e) {
            if (try_proxy) {
                try_proxy = false;
                continue;
            }
            // if this is already not the proxy,give up
            throw e;
        }
    }
}
项目:aakash-fdroid-client    文件DB.java   
@Override
public Iterator<String> iterator() {
          SimpleStringSplitter splitter = new SimpleStringSplitter(',');
          splitter.setString(value);
          return splitter.iterator();
      }
项目:aakash_bazaar_client    文件DB.java   
@Override
public Iterator<String> iterator() {
    SimpleStringSplitter splitter = new SimpleStringSplitter(',');
    splitter.setString(value);
    return splitter.iterator();
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。