android class-based

 

1. Android word back system based ........................................ 3

1.1 System Requirements Analysis .............................................. .................................................. .. 3

1.1.1 Example analysis ............................................. .................................................. 3

1.1.2 use cases described ............................................ ............................................ 4

1.2 system design .............................................. .................................................. .. 5

1.2.1 The main page of functional modules ........................................... ......................................... 5

1.3 detailed design .............................................. .................................................. .. 6

1.3.1 modification program module ............................................ ............................................ 6

1.3.2 Check the word library modules ........................................... ......................................... 6

1.3.3 start back word module ........................................... ......................................... 7

1.4 System database design .............................................. ................................................. 7

1.4 system implementation ............................................... .................................................. ......... 7

1.4.1 Check the word library modules ........................................... ......................................... 7

1.4.2 modification program module ............................................ .......................................... 11

1.4.3 start back word module ........................................... ....................................... 12

1.5 System Test ............................................... .................................................. ....... 13

2. summary ............................................... ............ 17

 

 

 

1. Android-based word back system

1.1 System Requirements Analysis

With economic globalization, we have more and more contact with foreigners, English has become the main tool for communication between China and the outside, people learning English more and more attention. As for learning English in particular, the way the memory of English words are constantly updated, and now the mobile Internet era, especially the extensive use of smart phones, the English learning platform has been gradually transferred to a computer or mobile phone and other mobile devices, the word back ways to enter a new field. Back word software is current popular and convenient and effective auxiliary memory tools, this article describes the word back software is an android-based application software platform, and its function is different from other word back software users need not to add their own custom You will need to back words, all the words that have been added after the word practice will be deleted, and then add new words. The word learning system, add the word, the word modify, delete the word and other functions.

1.1.1 Example analysis

1.1.2 Analysis of embodiment described with reference

    (1) Use Case Name: add a word

Execution is a user

Description: Add a word

Prerequisite is that users of the system

The result is a request to add a word

High frequency of use

    (2) Example Name: Edit word

Execution is a user

Note: For a word to be modified

Prerequisite is that users of the system

The result is a request word being modified

Low frequency of use

    (3) Use Case Name: look up words

Execution is a user

Description: Discover all words

Prerequisite is that users of the system

The result is a request to return all of the words in this system

High frequency of use

    (4) Use Case name: delete the word

Execution is a user

Description: delete a word

Prerequisite is that users of the system

The result is a request word is deleted

High frequency of use

 

 

 

 

 

 

 

 

1.2 System Design

 
   

 

 

 

 

1.2.1 The main page features modules

    The main page, there are three functional modules, respectively, modify the plan function modules, see the word library function modules and exercises word back function module.

1.2.1.1 modify the plan function modules

In the main page click "Edit program", you can enter the page to modify the plan, you can modify the number of daily schedule back word of the page and then return to the main page you can see the number of days if all the words memorized need.

1.2.1.2 Exercise word back module

     In the main page click on "Start it back the word" word back into the page, you can see the total number of words in the top left of the page, the Chinese meaning of each word are blocked when you click on a word, Chinese meant to appear, so convenient user training.

 

1.2.1.3 Query / add / modify / delete word function module

  Users click on the home page "to see the word Library", you can query all the words that have been added, click on the bottom right of the "Add" will add the word into the interface, fill in new words need back in the text box, click Save . Click on a word in the query page to enter the words you have added to modify and delete the word page, you can modify and delete the word on the page.

1.3 detailed design

1.3.1 modification program module

Modification program module

Numbering

Entry

deal with

Export

1

Click the Home Page button to modify the plan, enter the number of words a day back

The total number of words in the database, to calculate the number of days memorized all the words needed.

Jump to main page

 

1.3.2 Check the word library module

                        Check the word library module

Numbering

Entry

deal with

Export

1

Click on the main page to see the word Library button

Check out the database of all the words that have been added

Display a list of all check out the word, displays the total number of words

2

Click the Add button, enter a word information

Insert a new word to the database

Add content to display successful jump to the query word page

3

Click on the word you want to modify, input need to modify some of the information

Update the information in the database according to the word of a word id

Modify the contents of the display success, stay in the modified word page

4

Click on the word you want to delete, click the Delete button

Delete a word in the database according to the word id

Delete successful jump to the query word page

 

1.3.3 start back word module

                        Start back word module

Numbering

Entry

deal with

Export

1

Click the Home Page button to start memorizing words

Check out all the words in the database

Jump to practice all word list word interface display system and the total number of words

 

1.4 System Database Design

The UML demand use case diagram design structure of the database table system for implementing the desired function, and a table listing the structure of each database table in a tabular form, i.e., field name, data type, length, whether the main key, whether to allow null, descriptions.

 

 

Field name

type of data

length

Primary key

Be empty

Explanation

id

int

-

Yes

no

Word id

english

Varchar

20

no

no

English

chinese

Varchar

20

no

no

Chinese

 

1.4 system implementation

1.4.1        查看单词库模块

查看单词库模块有四个主要的功能,查询单词、添加单词、修改单词和删除单词。

1.4.1.1   添加单词

     

 

 

 

 

 

相关代码:

public void onClick(View v) {

              English = mEng.getText().toString();

              Chinese = mChi.getText().toString();

              DataUtil dataUtil = new DataUtil(this);

              if (English.length() > 0 && "".equals(English) && Chinese.length() > 0 && "".equals(Chinese)) {

                     Toast.makeText(this, "填写内容不得为空", 0).show();

              } else if (dataUtil.insert(English, Chinese)) {

                     Toast.makeText(this, "添加内容成功", 0).show();

                     finish();

              }

 

    }

1.4.1.2   查询单词

 

 

 

 

相关代码:

public void  list() {

       DataUtil dataUtil = new DataUtil(this);

       mList = dataUtil.query();

       mListIndex = mList.size();

       EndAdapter adapter = new EndAdapter(mList);

       mLw.setAdapter(adapter);

      

}    

1.4.1.3   修改/删除单词

 

 

 

 

相关代码 :

public void onClick(View v) {

       switch (v.getId()) {

       case R.id.bu_add2:

              mEnglish = mEng.getText().toString();

              mChinese = mChi.getText().toString();

              if (mEnglish.length() > 0 && "".equals(mEnglish) && mChinese.length() > 0 && "".equals(mChinese)) {

                     Toast.makeText(this, "填写内容不得为空", 0).show();

              } else if (mDataUtil.upadta(mEnglish, mChinese, mId)) {

                     Toast.makeText(this, "修改内容成功", 0).show();

              }

              break;

       default:

              if(mDataUtil.delect(mId)) {

                     Toast.makeText(this, "删除成功", 0).show();

                     finish();

              }else {

                     Toast.makeText(this, "删除失败", 0).show();

              }

              break;

       }

 

}

 

1.4.2        修改计划模块

  修改计划模块的功能是修改每天背单词的数量,计算背完单词需要的天数,在主页面显示。

1.4.2.1   我的计划

 

 

 

 

相关代码:

mNumber = Integer.parseInt(mNumbers.getText().toString());

Intent intents = new Intent();

intents.putExtra("number", mNumber);

setResult(2, intents);

finish();

protected void onCreate(Bundle savedInstanceState) {

       // TODO Auto-generated method stub

       super.onCreate(savedInstanceState);

       setContentView(R.layout.plan);

    Button confirm = (Button) findViewById(R.id.confirm);

    confirm.setOnClickListener(this);

    mNumbers = (EditText) findViewById(R.id.number);

       TextView day = (TextView) findViewById(R.id.day);

       mNumber = getnumber();

       mDay = gettotal()/mNumber;

       mNumbers.setText(mNumber+"");

       day.setText(mDay+"");

}

1.4.3        开始背单词模块

开始背单词模块的功能是查询出系统中添加的所有单词以及单词总数,练习背诵。

1.4.3.1   单词列表

 

 

 

 

相关代码:

protected void onCreate(Bundle savedInstanceState) {

       // TODO Auto-generated method stub

       super.onCreate(savedInstanceState);

       setContentView(R.layout.study);

       init();

}

public void init() {

       ListView Lw =(ListView) findViewById(R.id.lws);

       TextView tv = (TextView) findViewById(R.id.totals);

       DataUtil dataUtil = new DataUtil(this);

       List<EngBean> list =dataUtil.query();

       EndAdapters adapter = new EndAdapters(list);

       Lw.setAdapter(adapter);

       int listIndex = list.size();

       tv.setText(listIndex+"");

       Lw.setOnItemClickListener(this);

}

@Override

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

       TextView shadow = (TextView)view.findViewById(R.id.shadow);

       switch (shadow.getVisibility()) {

       case 0:

              shadow.setVisibility(View.INVISIBLE);

              break;

       case 4:

              shadow.setVisibility(View.VISIBLE);

              break;

       }

      

}

1.5        系统测试

本次课设所用的开发环境为

开发技术::android sqlite

数据库:SQLite3.5.83

开发工具:eclipse

1.5.1测试系统添加单词功能是否能正常使用

  点击“查看单词库”中“添加”按钮,向系统中添加单词“plan”“计划”

  测试结果:

      

 

 

 

  

 

 

1.5.2.测试系统中修改单词功能是否能正常使用

  将系统中单词“plan”的中文意思修改为“计划;方案”

  测试结果:

         

 

1.5.3.测试系统删除单词功能是否能正常使用

  将系统中单词“plan”“计划;方案”删除

  测试结果:

        

 

 

 

 

 

 

 

 

 

 

1.5.4.测试系统中修改计划功能是否能正常使用

 点击主页面“修改计划”,将“每日背单词”由“1”个改为“2”个

 测试结果:                

        

          

1.5.5.测试系统中查询单词功能是否能正常使用

  分别点击主页面“查看单词库”“开始背单词吧”进入查询单词页面

  测试结果:

            

 

 

 

 

 

1.5.6.测试系统中开始背单词页面的中文隐藏功能是否能正常使用

  点击任意单词,看是否会显示中文意思

  测试结果:

    

 

 

 

      

 

2. 总结

通过这次课程设计,编程水平有了很大的提高。该单词斩系统使用Java语言,使用Eclipse进行编写,从最开始编写这个程序到程序运行,经过对程序的反复调试与修改,深刻感受到编写一个程序是一个漫长而辛苦的过程,需要编程人员具备足够的耐心与细心。与此同时也培养我查阅知识并通过自学掌握知识的能力。程序的入手阶段是困难的,首先要做一些准备工作。要了解这个程序是干什么的,它应具备怎样的功能。当明确了这些问题以后,就要针对不同的功能逐一的思考实现该功能的方法。编程时要先制定一个大的框架,用几个模块,什么模块,那些事件过程,那些通用过程,当大致的轮廓出来后再进行深一步的编写,考虑语句的语法、逻辑,各个通用过程的调用,事件过程的实现。当然在编程的过程中最重要的一点就是善于总结,这样可以避免重蹈覆辙。在程序编写结束后,更要进行总结,认真思考怎样编写一个过程是简便快捷的,在下次遇到同样问题时可以节省时间,提高效率。这次做课程设计,了解了程序的编制过程和基本的思维方法,同时也对编程产生了更加浓厚的兴趣,希望能在课余时间多编制一些这样的程序,可以学到更多的知识,同时提高编程的速度,锻炼思考方式,开拓思维空间,为我今后的学习打下一个良好的基础。

 

 

 

附件1:

基于Android的背单词系统

技术说明

1. 开发技术: UI设计、SQLite数据库、Activity组件的应用、ListView的使用、   

                控件的隐藏 。

      UI设计:多个界面的嵌套与跳转
SQLite:数据库的增删改查
Activity:多Activity的切换
android中Visibility的应用:应用中单词意思的遮挡
ListView:单词库与练单词界面单词的显示

 

代码

清单文件:

 

 

  布局文件:

1.  截图:

 

 

2.  原文件

         

 

      

 

  

Java原码:

 

 

 

类说明:

EndAdapter:该类继承自BaseAdapter,用于获取Item总数、对象、Id、视图。

EndBean:储存每条数据的基本信息。
DBInit:该类中定义数据库的名称、表名、数据库版本、数据库表中的列名
DateUtil:定义数据库的添加、删除、修改、查询、方法
EditActivty:调用DateUtil中query()方法并实现添加单词的点击事件
MainActivty:实现查看单词库和背单词的点击事件
PlanActivty:实现修改计划界面
StudyActivty:使用Visibility实现了练习背诵的事件
UpdataActivty:调用DateUtil中upadta()更新消息
WritingActivty:调用DateUtil中insert()添加消息

  

 

Guess you like

Origin www.cnblogs.com/lj1221/p/12013705.html