自己学校简易Android查分数软件

没什么技术含量的一个小软件,用HttpClient登陆某正方系统后读取指定页面然后解析呈现。可以查分数和课表。

如果有和我一个学校的,那真是缘分了。

严重依赖页面的VIEWSTATE,虽然不知道这是啥,理论上应该自动解析出来的,偷懒就成了硬编码。

[1].[代码] [Java]代码 跳至 [1] [2]

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
protected void onPostExecute(String result) {
             if (result.equals( "FAIL" )) {
                 dialog.dismiss();
                 new AlertDialog.Builder(ScoreActivity. this ).setTitle( "错误" )
                         .setMessage( "无法连接服务器" ).setPositiveButton( "确定" , null )
                         .show();
             } else if (result.equals( "" ) || result == null
                     || result.length() == 0 ) {
                 dialog.dismiss();
                 new AlertDialog.Builder(ScoreActivity. this ).setTitle( "错误" )
                         .setMessage( "网络错误" ).setPositiveButton( "确定" , null )
                         .show();
             } else if (result.indexOf( "系统警告" ) != - 1 ) {
                 dialog.dismiss();
                 Toast.makeText(ScoreActivity. this , "系统警告,你懂的" ,
                         Toast.LENGTH_LONG).show();
             } else if (result != null ) {
                 dialog.dismiss();
                 Toast.makeText(ScoreActivity. this , "查询成功" , Toast.LENGTH_SHORT)
                         .show();
                 Log.d(TAG, "GetOK" );
                 Log.d(TAG, ScoreActivity. this .SCORE_PAGE);
 
                 Pattern pattern = Pattern.compile(PATTERN);
                 Matcher matcher = pattern.matcher(result);
                 while (matcher.find()) {
                     String str_year = matcher.group( 1 );
                     String str_term = matcher.group( 2 );
                     String str_name = matcher.group( 3 );
                     String str_type = matcher.group( 4 );
                     String str_teacher = matcher.group( 5 );
                     String str_test = matcher.group( 6 );
                     String str_score = matcher.group( 7 );
                     String str_MKEscore = matcher.group( 8 );
                     if (str_MKEscore.equals( " " ))
                         str_MKEscore = "无" ;
                     String str_rescore = matcher.group( 9 );
                     if (str_rescore.equals( " " ))
                         str_rescore = "无" ;
                     String str_credit = matcher.group( 11 );
                     year.add(str_year);
                     term.add(str_term);
                     name.add(str_name);
                     type.add(str_type);
                     teacher.add(str_teacher);
                     test.add(str_test);
                     score.add(str_score);
                     MKEscore.add(str_MKEscore);
                     rescore.add(str_rescore);
                     credit.add(str_credit);
                 }
 
                 for ( int i = 0 ; i < year.size(); ++i) {
                     Map<String, String> tmp = new HashMap<String, String>();
                     tmp.put( "year" , year.get(i));
                     tmp.put( "term" , term.get(i));
                     tmp.put( "name" , name.get(i));
                     tmp.put( "type" , type.get(i));
                     tmp.put( "teacher" , teacher.get(i));
                     tmp.put( "test" , test.get(i));
                     tmp.put( "score" , score.get(i));
                     tmp.put( "MKEscore" , MKEscore.get(i));
                     tmp.put( "rescore" , rescore.get(i));
                     tmp.put( "credit" , credit.get(i));
                     ITEM_INFO.add(tmp);
                 }
                 SimpleAdapter adapter = new SimpleAdapter(ScoreActivity. this ,
                         ITEM_INFO, R.layout.score_item_layout, FROM, TO);
                 lv_score.setAdapter(adapter);
             }
         }

[2].[文件] HuaXiaClient-master.zip ~ 350KB    下载(154) 跳至 [1] [2]


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值