1. 程式人生 > >Android英語單詞記憶程式原始碼

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英語單詞記憶程式原始碼

/** * 原始碼片段 */package wordroid.activitys;import java.util.ArrayList;import wordroid.database.DataAccess;import wordroid.model.R;import wor

俞敏洪老師談英語單詞記憶方法

記單詞本身不存在科學問題,能幫助記憶的方法就是最科學的。科學是為人服務的,如果不能為人類服務,這種科學可以不要。剛才你說的fatigue,其實特別好記,前面f-a-t,就是fat胖),後面的gue可以想象成argue爭論),再加一個i—我。胖,又喜歡爭論,可不就把自己搞疲憊了嗎?記單詞時自己總能想出些辦法,人

程式設計師必須掌握的600個英語單詞(轉自網路)

程式設計師必須掌握的600個英語單詞(轉自網路) application 應用程式 應用、應用程式 application framework 應用程式框架、應用框架 應用程式框架 architecture 架構、系統架構 體系結構 argument 引數(傳給函式的值)。叄見 para

怎樣快速記憶英語單詞

人的大腦是以一種發散性的思維進行爆炸性的思考 :     發散性 思維 訓練: 你會看到一個笑臉 ,有一個詞語“娛樂”(fun)正鑲嵌笑臉中間,有五個枝杈從笑臉向四周發散 ,在每一個枝杈 上又可以分為5個枝杈向外分散   遊戲具體

程式設計師必須掌握的600個英語單詞

application 應用程式 應用、應用程式 application framework 應用程式框架、應用框架 應用程式框架 architecture 架構、系統架構 體系結構 argument 引數(傳給函式的值)。叄見 parameter 叄數、實質叄數、實叄

android開源新聞小程式、3D翻轉公告效果、小說檢索、Kotlin開發TODO清單等原始碼

Android精選原始碼 開源新聞小程式原始碼分享 android動態桌布、鎖屏動畫、來電秀等原始碼 android筆記App效果原始碼 Android實現3D版翻頁公告效果 android小說搜尋閱讀原始碼 Android純Kotl

程式設計師常用英語單詞

application 應用程式 應用、應用程式 application framework 應用程式框架、應用框架 應用程式框架 architecture 架構、系統架構 體系結構 argument 引數(傳給函式的值)。叄見 parameter 叄數、實質叄數、實叄、自變數 array 陣列 陣

Android Launcher啟動應用程式流程原始碼解析

帶著問題看原始碼 點選桌面Launcher圖示後做了哪些工作? 應用程式什麼時候被建立的? Application和MainActivity的onCreate()方法什麼時候被呼叫的? 概述 在Android系統中,啟動四大元件中的任何一個都可以啟動應用程式。但絕大部分時候我們是通過點選Laun

android 記事本程式原始碼

應用實現密碼登陸,記事本內容可增刪改除等操作,用listview顯示每次儲存的記事內容,實現了記事本的基本功能。程式碼都有詳細註解。 1、程式碼的目錄 密碼登陸使用的是sharedpreferences記錄輸入的密碼,sharedPreferences簡單介紹 做軟體開

實時獲取股票資料的android app應用程式原始碼分享

最近學習Android應用開發,不知道寫一個什麼樣的程式來練練手,正好最近股票很火,就一個App來實時獲取股票資料,取名為Mystock。使用開發工具Android Studio,需要從Android官網下載,下載地址:http://developer.android.com/sdk/index.ht

Android M PackageManager應用程式許可權管理原始碼剖析及runtime permission實戰

Android應用許可權授予部分主要分為兩部分,第一部分是在PKMS啟動之後,且掃描完所有的app後,會對應用程式分配linux使用者組ID,即授予他們所申請的資源訪問許可權。 第一部分主要是對install等許可權進行無條件授予,而許多核心app的預設許可權則還沒有授

(編譯原理)C++原始碼單詞掃描程式(詞法分析)

實驗內容 (1)C++原始碼掃描程式識別C++記號。 C++語言包含了幾種型別的記號:識別符號,關鍵字,數(包括整數、浮點數),字串、註釋、特殊符號(分界符)和運算子號等。  (2)開啟一個C++原始檔,打印出所有以上的記號。  (3)選作部分:為了提高c++源程式的可讀性

聊聊程式設計師如何學習英語單詞:寫了一個記單詞的小程式

背景: 關於英文對程式設計師的重要性,就不多說了! 英語的學習,有很多,今天也不聊多,只聊英語單詞! 關於單詞的記憶,找過很多方法,下載過很多軟體。 如圖(其它不好用的都解除安裝了): 上圖算是我以前用過軟體,注意,是以前哦~~~ 意思就是沒有堅持下來~~~~ 隨時間的推

程式設計師 需要掌握的600個英語單詞

application 應用程式 應用、應用程式 application framework 應用程式框架、應用框架 應用程式框架 architecture 架構、系統架構 體系結構 argument 引數(傳給函式的值)。叄見 parameter 叄數、實質叄數、實叄、自變數&

生活中常用的625個英語單詞

beautiful bar roo tab 交通 學會 let ash inside 驚訝!學會這些625單詞就可以走遍天下! (動物) Animal: dog, cat, fish, bird, cow, pig, mouse, horse, wing, animal

和顏色有關的英語單詞

order black ack red mis alt 粉紅 ans 顏色 英語 漢語 antique violet 古紫色 aquamarine blue 藍綠色 baby pink 淺粉紅色 beige 灰褐

英語單詞

formal dia blog 標題 dial 字典 中心 變體 isa literary adj. 文學的 offensive adj. 無禮的 slang n. 俚語 taboo adj. 禁忌的 n. 禁忌 formal adj. 正式的、正規的 inform

程序員眼中的英語單詞

訪問 聚合 領域 英文 異步 mina 進程 contain 小包 單詞普通人眼中開發者眼中 socket 插座 套接字 performance 演出 性能 ATM 自動取款機 異步傳輸模式 memory

單詞記憶 2018.4.8

cat 域名 for 上一頁 navi class 路徑 navig 文件名 screen屏幕,avail可用,location位置,port端口,protocol協議,hostname web主機域名,pathname返回當前頁面的路徑和文件名,assign分配轉讓,hi

盤點網絡工程師需要掌握的英語單詞(A-C篇)

英文 網絡 常用 技術 因為網絡設備的配置大部分都是以英文為主的命令,所以想要成為網絡大神,英語水平還是有一定需要的。但是你說你英語實在是沒學好,或者是根本就不懂英語,怎麽辦呢?好嘛,那捷哥就為大家整理一些網絡工程師必須掌握的英語單詞,希望能對你有所幫助。 因為這都是本人自行整理,可能存在遺漏