zoukankan      html  css  js  c++  java
  • Android 获取Web地址栏参数

    String url = entity.getTPXW_ImgUrl().toString();
                    String[] parameters = { "ClassID" };
                    String u;
                    try {
                        u = URLDecoder.decode(url, "UTF-8");
                        String[] strLength = new String[0];
                        int strSplit1 = 0;
                        int strSplit2 = 0;
                        String strValue = "";
                        for (String s : parameters) {
                            if (u.indexOf(s) != -1) {
                                strLength = (u.substring(u.indexOf(s))).split("&");
                            }
                            for (int j = 0; j < strLength.length; j++) {
                                strValue += strLength[j];
                            }
                        }
                        if (strLength.length <= 0) {
                            strLength = null;
                        } else {
                            strSplit1 = strValue.indexOf("NewsID=");
                            String value1 = strValue.substring(8, strSplit1);
                            strSplit2 = strValue.lastIndexOf("=");
                            String value2 = strValue.substring(strSplit2 + 1,
                                    strValue.length());
                            entity.setTPXW_ClassID(Integer.parseInt(value1));
                            entity.setTPXW_NewsID(Integer.parseInt(value2));
                        }
                    } catch (UnsupportedEncodingException e) {
                        e.printStackTrace();
                    }
  • 相关阅读:
    2月4日进度
    每日总结3-6
    每日总结3-5
    每日总结3-4
    每日总结3-2
    本周计划
    本周计划
    假期每日总结2-13
    假期每日总结2-12
    假期每日总结2-11
  • 原文地址:https://www.cnblogs.com/xiaoyao095/p/4444998.html
Copyright © 2011-2022 走看看