• 团队作业-第四周-面向对象程序设计


    移动课堂点名APP

      一、源代码地址:https://github.com/WreckBear/final

      二、对程序涉及到的以下几个类进行简要说明:  

          CallNameActivity:显示全局点名的界面。
          CallNameAll:负责点名选择界面。
          CallNameRdmActivity:负责随机点名界面。
          CountActivity:负责统计界面。
          ImportActivity:负责导入文件的界面。
          MainActivity:主界面。
          MoreActivity:更多界面。
          MyDBOpenHelper:关于和数据库交互的类。
          MyInfoActivity:我的信息页。
          PersonDao:关于数据库请求类。
          SplashActivity:进入Splash界面。

      三、部分代码

          贴出统计页面的源码,简要说明下:

    复制代码
     1 public class CountActivity extends Activity {
     2     ListView listView;
     3     TextView text;
     4     LinearLayout linearLayout;
     5 
     6     @Override
     7     protected void onCreate(Bundle savedInstanceState) {
     8         super.onCreate(savedInstanceState);
     9         setContentView(R.layout.count_layout);
    10 
    11         text = (TextView) findViewById(R.id.toast);
    12         linearLayout = (LinearLayout) findViewById(R.id.instudct);
    13         listView = (ListView) findViewById(R.id.count);
    14     }
    15 
    16     @Override
    17     protected void onStart() {
    18         super.onStart();
    19         if (tabIsExist("kecheng1")) {
    20             linearLayout.setVisibility(View.VISIBLE);
    21             listView.setVisibility(View.VISIBLE);
    22             text.setVisibility(View.GONE);
    23             count();
    24         } else {
    25             linearLayout.setVisibility(View.GONE);
    26             listView.setVisibility(View.GONE);
    27             text.setVisibility(View.VISIBLE);
    28         }
    29     }
    30 
    31     public boolean tabIsExist(String tabName) {
    32         SQLiteDatabase dbInfo = new MyDBOpenHelper(this).getReadableDatabase();
    33         boolean result = false;
    34         if (tabName == null) {
    35             return false;
    36         }
    37         Cursor cursor = null;
    38         try {
    39             String sql = "select count(*) as c from sqlite_master where type ='table' and name ='"
    40                     + tabName.trim() + "' ";
    41             cursor = dbInfo.rawQuery(sql, null);
    42             if (cursor.moveToNext()) {
    43                 int count = cursor.getInt(0);
    44                 if (count > 0) {
    45                     result = true;
    46                 }
    47             }
    48         } catch (Exception e) {
    49             // TODO: handle exception
    50         } finally {
    51             dbInfo.close();
    52         }
    53         return result;
    54     }
    55 
    56     private void count() {
    57         // 存放数据用
    58         List<HashMap<String, String>> all = new ArrayList<HashMap<String, String>>();
    59         PersonDao per = new PersonDao(this);
    60         List<String[]> tmpList = per.getAllPerson();
    61         for (String[] tmpAll : tmpList) {
    62             HashMap hash = new HashMap<String, String>();
    63             hash.put("学号", tmpAll[0]);
    64             hash.put("班级", tmpAll[3]);
    65             hash.put("姓名", tmpAll[1]);
    66             hash.put("缺勤", tmpAll[4]);
    67             all.add(hash);
    68         }
    69         SimpleAdapter simple = new SimpleAdapter(this, all, R.layout.liststyle,
    70                 new String[] { "学号", "班级", "姓名", "缺勤" }, new int[] { R.id.t1,
    71                         R.id.t2, R.id.t3, R.id.t4 });
    72         listView.setAdapter(simple);
    73 
    74     }
    75 }
  • 相关阅读:
    101个微软提供的Visual Studio 2005示例[转贴]
    验证码的三种做法[纯数字][纯汉字][字母\数字\汉字混合]C#
    XML做数据库操作之 我浑了
    推荐几个用得上且免费的 .NET控件
    一些怪得你没想过的软件,大多还是有用的!
    ASP.NET 程序中常用的三十三种代码[转载与 aspcool]
    js入门系列演示·数组
    AJAX!?!入门之道
    js入门·移动窗体/弹出提示
    javascript入门系列演示·函数的定义以及简单参数使用,调用函数
  • 原文地址:https://www.cnblogs.com/liuxu8257/p/4576007.html
Copyright © 2020-2023  润新知