Caused by: java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 1:
         E/AndroidRuntime(17429): }
         E/AndroidRuntime(17429):  ^
         E/AndroidRuntime(17429):     at java.util.regex.Pattern.compileImpl(Native Method)
         E/AndroidRuntime(17429):     at java.util.regex.Pattern.compile(Pattern.java:400)
         E/AndroidRuntime(17429):     at java.util.regex.Pattern.<init>(Pattern.java:383)
         E/AndroidRuntime(17429):     at java.util.regex.Pattern.compile(Pattern.java:374)
         E/AndroidRuntime(17429):     at java.lang.String.split(String.java:1842)
         E/AndroidRuntime(17429):     at java.lang.String.split(String.java:1823)
         E/AndroidRuntime(17429):     atcom.tang.weather.WeatherMainActivity.onCreate(WeatherMainActivity.java:54)
         E/AndroidRuntime(17429):     at android.app.Activity.performCreate(Activity.java:5046)
         E/AndroidRuntime(17429):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)

         E/AndroidRuntime(17429):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2037)



代码:    temp =temp.split("}")[1];出错

“{” 是keyword符,要加上转意字符
        temp =temp.split("\\}")[1];


posted on 2017-05-02 12:47  lxjshuju  阅读(627)  评论(0编辑  收藏  举报