基于Sqlite開發(fā)圖書管理系統(tǒng)(可做畢業(yè)設(shè)計(jì))_第1頁(yè)
基于Sqlite開發(fā)圖書管理系統(tǒng)(可做畢業(yè)設(shè)計(jì))_第2頁(yè)
基于Sqlite開發(fā)圖書管理系統(tǒng)(可做畢業(yè)設(shè)計(jì))_第3頁(yè)
基于Sqlite開發(fā)圖書管理系統(tǒng)(可做畢業(yè)設(shè)計(jì))_第4頁(yè)
基于Sqlite開發(fā)圖書管理系統(tǒng)(可做畢業(yè)設(shè)計(jì))_第5頁(yè)
已閱讀5頁(yè),還剩34頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

期末考核報(bào)告-手機(jī)軟件編寫技術(shù)班級(jí):一.1.Andriod的簡(jiǎn)介AndroidGoogle2007115Linux統(tǒng)、中間件、用戶界面和應(yīng)用軟件組成,號(hào)稱是首個(gè)為移動(dòng)終端打造的真正開放和完整的移動(dòng)軟件。目前,最新版本為Android2.4GingerbreadAndroid3.0Honeycomb。AndroidLinuxGoogle2007115日公布的手機(jī)操作系統(tǒng)。Android"Android"的公2005"Android.Inc"Androidstack,又名軟件疊層)的架構(gòu),主要分LinuxJava2011AndroidMP4AndroidHTC,(G1HTC)美國(guó)摩托羅拉,SE中國(guó)大陸廠商如:魅族(M9),華為、中興、聯(lián)想、藍(lán)魔等。2.Android構(gòu)架圖二.1軟件下載AndroidSDK,網(wǎng)址是.二.1軟件下載JDK的下載地址/javase/downloads/widget/jdk6.jsp。Eclipse/downloads/2.Android第一步:下載AndroidSDK網(wǎng)址是./sdk/index.html。Android1.5GoogleAndroidSDKAndroid1.6只提供了安裝工具在線安裝。單擊“android-sdk-windows.zip”SDKSDKSetup.exe行該文件。"AvailablePackages",選擇想安裝的版本(我是全選了,省事,然后單擊“InstallSelected”->選擇“AcceptAll”,再單擊“InstallAccepted”就可以在線安裝了。提示:如果你的“AvailablePackages”的“Setting”選項(xiàng),在右側(cè)的設(shè)置中勾選“Forehttps://.”第二步:安裝JDKA下載JDKAndroidSDK需要JDK5以上的版本。JDK6的下載地址/javase/downloads/widget/jdk6.jsp。BJDKCJava配置JavaHomeJava的安裝路徑,右鍵單擊“我的電腦”->“屬性”->“高級(jí)”—>“環(huán)境變量”中新建環(huán)境變量java裝路徑。PathPathJavabin與變量中間使用分號(hào)“;”分隔。配置classpath量”,在“系統(tǒng)環(huán)境變量”中新建一個(gè)系統(tǒng)變量名稱為“classpath”,變量值為半角句號(hào)“.”第三步:下載EclipseADT插件要求Eclipse的版本是3.3以上,Eclipse的下載網(wǎng)址是/downloads/。下載后解壓可以直接使用。下載安裝ADT。這里介紹通過(guò)Eclipse在線更新的方式安裝。Eclipse,選擇“Help”->“InstallNewSoftware.”單擊“Add.....”(http能連接失敗。(Name:ADT0.9.5;Location/android/eclipse/)添加好后,勾選“DeveloperTools”單擊“Next”進(jìn)行更新安裝。AndroidSQLite夠?qū)崿F(xiàn)查詢、增加、刪除、修改學(xué)生相應(yīng)信息的功能。1.SDK、JDK2.Eclipse4.UI(layout5.Button7.ActivityActivity8.對(duì)按鍵(Button)的監(jiān)聽。9.編寫.JAVA和.XML文件。實(shí)訓(xùn)目的:Eclipse,SDK,JDK。androidandroidUIUIUI,UI能夠簡(jiǎn)單的編寫界面的布局(XML)文件。UIJAVA設(shè)計(jì)流程:流程圖首先分別編寫MainActivity的布局文件(XML)activity_main.xml<RelativeLayoutxmlns:android="/apk/res/android"xmlns:tools="/tools"android:id="@+id/screen"android:layout_width="match_parent"android:layout_height="match_parent"android:paddingBottom="@dimen/activity_vertical_margin"android:paddingLeft="@dimen/activity_horizontal_margin"android:paddingRight="@dimen/activity_horizontal_margin"android:paddingTop="@dimen/activity_vertical_margin"tools:context=".MainActivity"android:background="@drawable/background_login"><LinearLayoutandroid:id="@+id/loginPanel"android:layout_width="400dp"android:layout_height="300dp"android:layout_centerHorizontal="true"android:orientation="vertical"android:layout_marginTop="50dp"android:background="@drawable/background_login_div"><TextViewandroid:id="@+id/textView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_horizontal"android:text="學(xué)生信息管理系統(tǒng)"android:layout_marginTop="15dp"android:textSize="25dp"/><TextViewandroid:id="@+id/textView2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_horizontal"android:layout_marginTop="10dp"android:text="請(qǐng)先登錄"/><EditText android:id="@+id/userName"android:layout_width="match_parent"android:layout_height="50dp"android:layout_marginLeft="50dp"android:layout_marginRight="50dp"android:layout_marginTop="15dp"android:singleLine="true"android:background="@drawable/qq_edit_login"android:hint="請(qǐng)輸入您的用戶名"android:ems="10"<requestFocus/></EditText><EditTextandroid:id="@+id/userPassword"android:layout_width="match_parent"android:layout_height="50dp"android:layout_marginLeft="50dp"android:layout_marginRight="50dp"android:layout_marginTop="15dp"android:singleLine="true"android:password="true"android:background="@drawable/qq_edit_login"android:hint="請(qǐng)輸入您的密碼"android:ems="10"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="10sp" <Buttonandroid:id="@+id/login"android:layout_width="10sp"android:layout_height="match_parent"android:text="登錄"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:background="@drawable/background_button_div"android:layout_weight="1"/><Buttonandroid:id="@+id/register"android:layout_width="10sp"android:layout_height="match_parent"android:text="注冊(cè)"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:background="@drawable/background_button_div"android:layout_weight="1"/><Buttonandroid:id="@+id/exit"android:layout_width="10sp"android:layout_height="match_parent"android:text="退出"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:background="@drawable/background_button_div"android:layout_weight="1"/></LinearLayout></LinearLayout></RelativeLayout>注冊(cè)界面Registerlayout.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:background="#FFACDAE5" ><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal" <TextView<EditText

android:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="用戶名:"/>android:id="@+id/editText1"android:layout_width="match_parent"android:layout_height="wrap_content"android:textColor="#bfbfbf"android:singleLine="true"android:background="@drawable/qq_edit_login"android:hint="請(qǐng)輸入用戶名"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal" <TextView<EditText

android:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="密碼:"/>android:id="@+id/editText2"android:layout_width="match_parent"android:layout_height="wrap_content"android:hint="請(qǐng)輸入密碼"android:singleLine="true"android:background="@drawable/qq_edit_login"android:textColor="#bfbfbf"android:inputType="textPassword"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal" <TextViewandroid:layout_width="wrap_content"<EditText

android:layout_height="wrap_content"android:textSize="20sp"android:text="確認(rèn)密碼:"/>android:id="@+id/editText3"android:layout_width="match_parent"android:layout_height="wrap_content"android:hint="請(qǐng)?jiān)佥斎朊艽a"android:singleLine="true"android:background="@drawable/qq_edit_login"android:textColor="#bfbfbf"android:inputType="textPassword"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="5sp" <Buttonandroid:id="@+id/btn_confirm"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:layout_marginBottom="10sp"android:layout_weight="1"android:background="@drawable/background_button_div"android:text="確認(rèn)"/><Buttonandroid:id="@+id/btn_back"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:layout_marginBottom="10sp"android:layout_weight="1"android:background="@drawable/background_button_div"android:text="返回"/></LinearLayout></LinearLayout>Showstudentinf.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:background="#f5f5f5"><ScrollViewandroid:layout_width="match_parent"android:layout_height="match_parent"><LinearLayout<LinearLayout

android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical" android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><LinearLayout

android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:orientation="vertical"><LinearLayout android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="姓名/><EditTextandroid:id="@+id/sname"android:layout_width="70dp"android:layout_height="45dp"android:background="@drawable/qq_edit_login"android:enabled="false"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="性別/><EditTextandroid:id="@+id/ssex"android:layout_width="70dp"android:layout_height="40dp"android:background="@drawable/qq_edit_login"android:enabled="false"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal">android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="民族/><EditTextandroid:id="@+id/smingzu"android:layout_width="70dp"android:layout_height="40dp"android:background="@drawable/qq_edit_login"android:enabled="false"/></LinearLayout></LinearLayout></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="學(xué)號(hào)/><EditTextandroid:id="@+id/sid"android:layout_width="136dp"android:layout_height="40dp"android:background="@drawable/qq_edit_login"android:enabled="false"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="生日/><EditTextandroid:id="@+id/sbir"android:layout_width="140dp"android:layout_height="40dp"android:background="@drawable/qq_edit_login"android:enabled="false"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="電話/><EditTextandroid:id="@+id/sphone"android:layout_width="140dp"android:layout_height="40dp"android:background="@drawable/qq_edit_login"android:enabled="false"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="20sp"android:text="備注/><EditTextandroid:id="@+id/smore"android:layout_width="196dp"android:layout_height="wrap_content"android:layout_weight="0.04"android:background="@drawable/qq_edit_login"android:enabled="false"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center_horizontal"android:orientation="horizontal"><Viewandroid:layout_width="100px"android:layout_height="0px"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:layout_marginTop="10dp"><Buttonandroid:id="@+id/sxiugai"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:layout_marginBottom="10sp"android:layout_weight="1"android:background="@drawable/background_button_div"android:text="修改"/><Buttonandroid:id="@+id/sok"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:layout_marginBottom="10sp"android:layout_weight="1"android:background="@drawable/background_button_div"android:text="確定"/><Buttonandroid:id="@+id/scancel"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:layout_marginBottom="10sp"android:layout_weight="1"android:background="@drawable/background_button_div"android:text="取消"/></LinearLayout></LinearLayout></ScrollView></LinearLayout>studentinfomationmaneger.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:background="#e0e0e0"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><CheckBoxandroid:id="@+id/checkboxsum"android:layout_width="wrap_content"android:layout_height="wrap_content"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:text="姓名"android:textSize="20sp"android:gravity="center"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:text="學(xué)號(hào)"android:textSize="20sp"android:gravity="center"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:text="性別"android:textSize="20sp"android:gravity="center"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent" <ListViewandroid:id="@+id/stu_listview"android:layout_width="match_parent"android:layout_height="match_parent"></ListView></LinearLayout></LinearLayout></LinearLayout>Fouractivity_layout.xml<?xmlversion="1.0"encoding="utf-8"?><AbsoluteLayoutandroid:id="@+id/widget0"android:layout_width="fill_parent"android:layout_height="fill_parent"xmlns:android="/apk/res/android"><TextViewandroid:id="@+id/widget32"android:layout_width="244dp"android:layout_height="58dp"android:text="恭喜你!找回密码成功!"android:textSize="20sp"android:textStyle="bold"android:layout_x="44dp"android:layout_y="96dp"/><ImageViewandroid:id="@+id/photo"android:src="@drawable/gongxi"android:layout_x="-7dp"android:layout_y="6dp"android:layout_width="339dp"android:layout_height="496dp"></ImageView></AbsoluteLayout>stulistviewitems.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="horizontal"android:descendantFocusability="blocksDescendants"><CheckBoxandroid:id="@+id/stu_checkbox"android:layout_width="wrap_content"android:layout_height="wrap_content"/><TextViewandroid:id="@+id/stu_list_name"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="#FF0000"android:layout_weight="1"android:text="姓名"/><TextViewandroid:id="@+id/stu_list_id"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="#FF0000"android:layout_weight="1"android:text="學(xué)號(hào)"/><TextViewandroid:id="@+id/stu_list_sex"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="#FF0000"android:layout_weight="1"android:text="性別"/></LinearLayout>Usermanagelayout.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><CheckBoxandroid:id="@+id/user_checkboxsum"android:layout_width="wrap_content"android:layout_height="wrap_content"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:gravity="center"android:text="用戶名"android:textSize="20sp"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:gravity="center"android:text="密碼"android:textSize="20sp"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:gravity="center"android:text="超級(jí)用戶"android:textSize="20sp"/></LinearLayout><ListViewandroid:id="@+id/user_listview"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_weight="1"></ListView><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center_horizontal"><Buttonandroid:id="@+id/user_delete"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:layout_weight="1"android:background="@drawable/background_button_div"android:text="刪除" /><Buttonandroid:id="@+id/user_cancel"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginRight="10sp"android:layout_marginLeft="10sp"android:layout_weight="1"android:background="@drawable/background_button_div"android:text="退出"/></LinearLayout></LinearLayout>Userlistitems.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="horizontal"><CheckBoxandroid:id="@+id/user_checkbox"android:layout_width="wrap_content"android:layout_height="wrap_content"/><TextViewandroid:id="@+id/user_name"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:gravity="center"android:text="用戶名"android:textColor="#ff0000"/><TextViewandroid:id="@+id/user_password"android:layout_width="150px"android:layout_height="wrap_content"android:gravity="center"android:text="密碼"android:ellipsize="marquee"android:textColor="#ff0000"/><CheckBoxandroid:id="@+id/user_flag"android:layout_width="wrap_content"android:layout_height="wrap_content"android:gravity="center"android:layout_weight="1"/></LinearLayout>然后分別編寫五個(gè)activity的JAVA代碼MainActivity.javapackageedu.ptu.studentmanager;importjava.util.ArrayList;importjava.util.List;importedu.ptu.studentmanager.help.MySqlHelper;importandroid.app.*;importandroid.content.ContentValues;importandroid.content.Intent;importandroid.database.Cursor;importandroid.database.sqlite.SQLiteDatabase;importandroid.os.Bundle;importandroid.view.LayoutInflater;publicclassMainActivityextendsActivity{privateEditTextuserName;privateEditTextuserPassword;privateButtonbtn_register;privateButtonbtn_login;privateButtonbtn_exit;privateMySqlHelpermySqlHelper;privateSQLiteDatabasedb;privateList<String>lists=newArrayList<String>();@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去除狀態(tài)欄黑條setContentView(R.layout.activity_main);mySqlHelper=newMySqlHelper(MainActivity.this,"student_inf.db",null,1);db=mySqlHelper.getWritableDatabase();Cursorcursorstu=db.rawQuery("select*fromloginhistory",null);while(cursorstu.moveToNext()){lists.add(cursorstu.getString(1));}userName=(EditText)findViewById(R.id.userName);userPassword=(EditText)findViewById(R.id.userPassword);btn_register=(Button)findViewById(R.id.register);btn_login=(Button)findViewById(R.id.login);btn_exit=(Button)findViewById(R.id.exit);btn_register.setOnClickListener(newOnClickListener(){@Override});

publicvoidonClick(Viewv){//TODOAuto-generatedmethodstubshowMyDialog(); }btn_login.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstublogin();}});btn_exit.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubfinish();}});}注冊(cè)publicvoidshowMyDialog(){Builderbuilder=newBuilder(MainActivity.this);LayoutInflaterinflater=LayoutInflater.from(MainActivity.this);Viewview=inflater.inflate(R.layout.registerlayout,null);Buttonbtn_confirm=(Button)view.findViewById(R.id.btn_confirm);Buttonbtn_back=(Button)view.findViewById(R.id.btn_back);finalEditTexteditUserName=(EditText)view.findViewById(R.id.editText1);finalEditTexteditPswd=(EditText)view.findViewById(R.id.editText2);finalEditTexteditPswd_confirm=(EditText)view.findViewById(R.id.editText3);finalAlertDialogdialog=builder.setTitle("管理員注冊(cè)").setView(view).create();btn_confirm.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){if(!(editPswd.getText().toString().equals("")&&editPswd.getText().toString().equals(""))){//TODOAuto-generatedmethodstubif((editPswd.getText().toString()).equals((editPswd_confirm.getText().toString()))){Cursorcursor=db.rawQuery("selectcount(*)fromuserwhereusername='"+editUserName.getText().toString()+"'",null);cursor.moveToNext();intcount=cursor.getInt(0);if(count==0){ContentValuesvalues=newContentValues();values.put("username",editUserName.getText().toString());values.put("password",editPswd.getText().toString());db.insert("user",null,values);dialog.dismiss();Toast.makeText(MainActivity.this,"注冊(cè)成功!",Toast.LENGTH_SHORT).show();}else{Toast.makeText(MainActivity.this,"您注冊(cè)的用戶名已存在!",Toast.LENGTH_SHORT).show();}cursor.close();}else{Toast.makeText(MainActivity.this,"您兩次輸入的密碼不一樣!",Toast.LENGTH_SHORT).show();}});

}}else{Toast.makeText(MainActivity.this,"密碼或者用戶名不能為空",Toast.LENGTH_SHORT).show();}dialog.show();btn_back.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubdialog.dismiss();}});}登錄publicvoidlogin(){Cursorcursor1=db.rawQuery("selectcount(*)fromuserwhereusername='"+userName.getText().toString()+"'",null);cursor1.moveToNext();intcount=cursor1.getInt(0);if(count==1){Cursorcursor=db.rawQuery("selectusername,passwordfromuserwhereusername='"+userName.getText().toString()+"'",null);cursor.moveToNext();if((userName.getText().toString()).equals(cursor.getString(0).toString())&&(userPassword.getText().toString()).equals(cursor.getString(1).toString())){Toast.makeText(MainActivity.this,"登錄成功!",Toast.LENGTH_SHORT).show();Intentintent=newIntent(MainActivity.this,StudentInformationManagerActivity.class);startActivity(intent);Cursorcursor2=db.rawQuery("selectcount(*)fromloginhistorywherename=+userName.getText().toString()+"'",null);cursor2.moveToNext();intcount2=cursor2.getInt(0);if(count2==0){ContentValuesvalues=newContentValues();values.put("name",userName.getText().toString());db.insert("loginhistory",null,values);}else{Toast.makeText(MainActivity.this,"您輸入的用戶名或密碼錯(cuò)誤!",Toast.LENGTH_SHORT).show();}cursor.close();}else{Toast.makeText(MainActivity.this,"您輸入的用戶名或密碼錯(cuò)誤!",Toast.LENGTH_SHORT).show();}cursor1.close();}@OverridepublicbooleanonCreateOptionsMenu(Menumenu){//Inflatethemenu;thisaddsitemstotheactionbarifitispresent.getMenuInflater().inflate(R.menu.main,menu);returntrue;}}Oneactivity.javapackagecom.eoeandroid.layout;importandroid.app.Activity;importandroid.os.Bundle;publicclassoneactivityextendsActivity{/**Calledwhentheactivityisfirstcreated.*/@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);;setContentView(R.layout.oneactivity_layout);}}StudentInformationManagerActivity.javapackageedu.ptu.studentmanager;importjava.util.ArrayList;importjava.util.List;importedu.ptu.studentmanager.help.MySqlHelper;importedu.ptu.studentmanager.henry.Student;importandroid.app.ActionBar;importandroid.app.Activity;importandroid.widget.*;publicclassStudentInformationManagerActivityextendsActivity{privateMySqlHelpermySqlHelper;privateSQLiteDatabasedb;privateList<Student>students=newArrayList<Student>();privateListViewstu_listview;privateCheckBoxcheckboxsum;privatebooleanchboxall=false;privateStringupdateName;privateAutoCompleteTextViewserach_edit;privateList<String>lists=newArrayList<String>();privateActionBaractionBar;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){//TODOAuto-generatedmethodstubsuper.onCreate(savedInstanceState);setContentView(R.layout.studentinfomationmaneger);mySqlHelper=newMySqlHelper(StudentInformationManagerActivity.this,"student_inf.db",null,1);db=mySqlHelper.getWritableDatabase();actionBar=getActionBar();actionBar.setDisplayShowHomeEnabled(false);actionBar.setHomeButtonEnabled(false);actionBar.setDisplayShowTitleEnabled(false);checkboxsum=(CheckBox)findViewById(R.id.checkboxsum);checkboxsum.setOnCheckedChangeListener(newOnCheckedChangeListener(){@OverridepublicvoidonCheckedChanged(CompoundButtonarg0,booleanarg1){//TODOAuto-generatedmethodstubchboxall=arg1;stu_adapter.notifyDataSetChanged();}});stu_listview=(ListView)findViewById(R.id.stu_listview);stu_listview.setAdapter(stu_adapter);stu_listview.setOnItemClickListener(newOnItemClickListener(){@OverridepublicvoidonItemClick(AdapterView<?>arg0,Viewarg1,intarg2,longarg3){//TODOAuto-generatedmethodstubshowInformation(arg2);System.out.println(arg2);}});}publicvoidaddStudent(){Intentintent=newIntent(StudentInformationManagerActivity.this,AddStudentActivity.class);startActivity(intent);}publicvoiddelStudent(){for(Studentstudent:students){System.out.println(student.isChecked());if(student.isChecked()){Cursorcursor=db.rawQuery("deletefromstudentwhereid='"+student.getId()+"'",null);cursor.moveToNext();}}//Cursorcursor=//db.rawQuery("deletefromstudentwhereid='"+id+"'",null);//cursor.moveToNext();onResume();//chboxall=false;}publicvoidshowInformation(finalinttemp){Builderbuilder=newBuilder(StudentInformationManagerActivity.this);LayoutInflaterinflater=LayoutInflater.from(StudentInformationManagerActivity.this);Viewview=inflater.inflate(R.layout.showstudentinf,null);finalAlertDialogdialog=builder.setTitle("學(xué)生詳細(xì)信息").setView(view).create();Buttonsxiugai=(Button)view.findViewById(R.id.sxiugai);Buttonsok=(Button)view.findViewById(R.id.sok);Buttonscancel=(Button)view.findViewById(R.id.scancel);finalEditTextsname=(EditText)view.findViewById(R.id.sname);finalEditTextssex=(EditText)view.findViewById(R.id.ssex);finalEditTextsmingzu=(EditText)view.findViewById(R.id.smingzu);finalEditTextsid=(EditText)view.findViewById(R.id.sid);finalEditTextsbir=(EditText)view.findViewById(R.id.sbir);finalEditTextsphone=(EditT

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論