Android英语单词记忆程序源码
/**
* 源码片段
*/
package wordroid.activitys;
import java.util.ArrayList;
import wordroid.database.DataAccess;
import wordroid.model.R;
import wordroid.model.Word;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
/**
* @author Administrator
*
*/
public class EditWord extends Activity implements OnClickListener{
private String action;
private EditText spelling;
private EditText meanning;
private Button confirm;
private Button cancel;
private Word word;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setTitle("编辑生词本");
this.setContentView(R.layout.editword);
Bundle bundle = this.getIntent().getExtras();
action = bundle.getString("action");
initWidgets();
}
private void initWidgets() {
// TODO Auto-generated method stub
this.spelling = (EditText) this.findViewById(R.id.EditWord_spelling);
this.cancel = (Button) this.findViewById(R.id.attention_cancel_button);
this.confirm = (Button) this.findViewById(R.id.attention_confirm_button);
this.meanning = (EditText) this.findViewById(R.id.EditWord_meanning);
cancel.setOnClickListener(this);
confirm.setOnClickListener(this);
if (action.equals("edit")){
Bundle bundle = this.getIntent().getExtras();
DataAccess data = new DataAccess(this);
Word word =data.QueryAttention("ID ='"+bundle.getString("id")+"'", null).get(0);
spelling.setText(word.getSpelling());
meanning.setText(word.getMeanning());
}
}
@SuppressWarnings("unused")
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (v==cancel){
finish();
}
if (v==confirm){
if (meanning.getText().toString().equals("")||spelling.getText().toString().equals("")){
Toast.makeText(EditWord.this, "信息不能为空", Toast.LENGTH_SHORT).show();
return;
}
if (action.equals("add")){
boolean add =true;
final DataAccess data = new DataAccess(this);
ArrayList<word> words = data.QueryAttention(null, null);
for(int i=0;i<words.size();i++){ if(this.spelling.gettext().tostring().equals(words.get(i).getspelling())){="" add="false;" log.i("thesame",="" ""+i);="" word="words.get(i);" }="" if="" (!add){="" dialog="" alertdialog.builder(this)="" .seticon(r.drawable.dialog_icon)="" .settitle("该单词已存在")="" .setmessage("生词本中有这个单词,要覆盖掉它吗?")="" .setpositivebutton("确定",="" new="" dialoginterface. {="" public="" void="" dialog,="" int="" whichbutton)="" word.setspelling(spelling.gettext().tostring());="" word.setmeanning(meanning.gettext().tostring());="" data.updateattention(word);="" finish();="" })="" .setnegativebutton("取消",="" }).create();="" dialog.show();="" if(add){="" word1="new" word();="" word1.setmeanning(this.meanning.gettext().tostring());="" word1.setspelling(this.spelling.gettext().tostring());="" word1.setphonetic_alphabet("="" ");="" data.insertintoattention(word1);="" else="" (action.equals("edit")){="" bundle="" bundle();="" dataaccess="" data="new" dataaccess(editword.this);="" =="" '"+bundle.getstring("id")+"'",="" null).get(0);="" word.setmeanning(this.meanning.gettext().tostring());="" word.setspelling(this.spelling.gettext().tostring());="" <="" pre="">
</words.size();i++){></word>
Android英语单词记忆程序源码相关推荐
- android 英语单词app源码,Android英语单词记忆程序源码
/** * 源码片段 */ package wordroid.activitys; import java.util.ArrayList; import wordroid.database.DataA ...
- android飞信短信箱程序源码讲解
android飞信短信箱程序源码讲解! 一.程序演示 图1.进入程序后的第1页面,头部的新消息提示在任意页面都会弹出. 图2.未读消息数量提示,任意页面. 图3.点击新建短信,(或者会话中的转发选项) ...
- [附源码]计算机毕业设计Python+uniapp基于Android的懂球帝APPqkwan(程序+源码+LW+远程部署)
[附源码]计算机毕业设计Python+uniapp基于Android的懂球帝APPqkwan(程序+源码+LW+远程部署) 该项目含有源码.文档.程序.数据库.配套开发软件.软件安装教程 项目运行环境 ...
- Android 24点游戏 程序 源码
既然24点的算法写出来了,那就顺便做一个android的小游戏吧. 界面比较简单,也没用复杂的控件. 比http://blog.csdn.net/problc/article/details/7225 ...
- python GUI毕业设计单词记忆软件 源码下载
# PyMemo 毕业设计--单词记忆软件 **文档:`doc/_build/html/index.html`** ---- Python:2.7.9 GUI:wxpython2.7.9 IDE:Py ...
- c语言单词记忆软件源码,c语言课程设计背单词系统的程序代码
c语言课程设计背单词系统的程序代码 1综合性程序设计报告设计题目:背单词系统指导教师:班 级:学 号:设 计 者:成 绩:设计时间:2010 年 5 月 27 日2目录1 题目描述---------- ...
- android日历提醒小程序源码,微信小程序倒班日历简洁实用demo完整源码
设计思路 日期选择器,单个View 一共有42个元素 当月的日期 以及 前后月份的部分日期 月份选择器 这个简单 一年一共12个月 年份选择器 这个需要根据当前年份 前后生成一系列的年份 日期选择器大 ...
- Android实用应用程序源码
andriod闹钟源代码 http://www.apkbus.com/android-20974-1-1.html android源码分享之指南针程序 http://www.apkbus.com/an ...
- android源码大全 IOS游戏源代码打包下载 小游戏|视频教程 微信小程序源码带后台全套|公众号平台
不断更新中,下面是2017-12-22更新部分 IOS_源码及视频一小部分: 开发环境:Xcode 基于cocos2d的tweejump跳跃游戏ios经典游戏源码.rar https://pan.b ...
最新文章
- Java并发编程:线程封闭和ThreadLocal详解
- 一文概览 CVPR2021 最新18篇 Oral 论文
- J2EE用监听器实现同一用户只能有一个在线
- jquery-1 jquery几个小实例
- 如何在C/S下打印报表
- opencv学习笔记2:图像处理基础
- C/C++学习之路: 继承
- 错误: 元素值必须为常量表达式_C语言编程常见错误集锦 【下】
- c语言课程设计修改订单流程图,C语言课程设计————写下流程图! 谢谢
- 架构师:我们需要顶层设计
- mnist手写数字数据集_mnist手写数据集(1. 加载与可视化)
- poj 2503 Babelfish
- 解决asp数据库对象只读的办法
- matlab安装前有兼容性问题,matlab安装及问题解决
- Android RTSP IPC的使用
- 手把手教你 | 识别色环电阻/贴片电阻阻值
- Shiro源码分析(三)——获取Subject
- 【历史上的今天】5 月 25 日:雅虎与 eBay 联盟;第一次国际万维网会议;Google 街景发布
- 漏洞系列一一看我一招征服漏洞SSRF
- Pygame实现小球躲避