diff --git a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/Com1314080901208.java b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/Com1314080901208.java
index 6c839c28..8ea5e82c 100644
--- a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/Com1314080901208.java
+++ b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/Com1314080901208.java
@@ -1,15 +1,65 @@
-package com.example.myapp;
+package com.example.passwordbox;
import android.os.Bundle;
import android.app.Activity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
import android.view.Menu;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
public class Com1314080901208 extends Activity {
+ private MyDatabaseHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_com1314080901208);
+ dbHelper=new MyDatabaseHelper(this, "PasswordBox.db", null, 2);
+ Button TiJiaoBtn=(Button)findViewById(R.id.TiJiaoBtn);
+ TiJiaoBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ // TODO Auto-generated method stub
+
+ EditText userNameText=(EditText)findViewById(R.id.userName);
+ EditText paddwordText=(EditText)findViewById(R.id.password);
+ SQLiteDatabase db=dbHelper.getWritableDatabase();
+ // 查询Login表中所有的数据
+ Cursor cursor=db.rawQuery("select * from Login where userName='"+userNameText.getText().toString()+"'", null);
+ if(cursor.getCount()==0)
+ {
+ Toast.makeText(Com1314080901208.this,"用户名不存在",Toast.LENGTH_LONG).show();
+ }
+ else
+ {
+ Toast.makeText(Com1314080901208.this,"登录成功",Toast.LENGTH_LONG).show();
+ Intent intent=new Intent(Com1314080901208.this,AcountListView.class);//显示Intent
+ startActivity(intent);
+ }
+
+ //Toast.makeText(Com1314080901208.this,cursor.getCount(),Toast.LENGTH_LONG).show();
+// Intent intent = new Intent("com.example.passwordbox.ACTION_START");//隐式Intent
+// intent.addCategory("android.intent.category.MY_CATEGORY");//这里指定了Category为MY_CATEGORY,如果没有指定这个时默认为default
+// //Intent intent=new Intent(Com1314080901208.this,activity2.class);//显示Intent
+// startActivity(intent);
+ }
+ });
+
+ //点击注册跳转到注册页面
+ Button RegisterBtn=(Button)findViewById(R.id.RegisterBtn);
+ RegisterBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ // TODO Auto-generated method stub
+ Intent intent=new Intent(Com1314080901208.this,Register.class);
+ startActivity(intent);
+ }
+ });
+
}
diff --git a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/activity_com1314080901208.xml b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/activity_com1314080901208.xml
new file mode 100644
index 00000000..0a110127
--- /dev/null
+++ b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/activity_com1314080901208.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/drawable-hdpi/login_bg.jpg b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/drawable-hdpi/login_bg.jpg
new file mode 100644
index 00000000..736a0dea
Binary files /dev/null and b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/drawable-hdpi/login_bg.jpg differ
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2143.png" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2143.png"
new file mode 100644
index 00000000..0e6d3a6a
Binary files /dev/null and "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2143.png" differ
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AcountListView.java" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AcountListView.java"
new file mode 100644
index 00000000..5c6deb3e
--- /dev/null
+++ "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AcountListView.java"
@@ -0,0 +1,70 @@
+package com.example.passwordbox;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.Toast;
+
+public class AcountListView extends Activity{
+ private List acountList=new ArrayList();
+ private MyDatabaseHelper dbHelper;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // TODO Auto-generated method stub
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.acount_listview);
+ initAcount();
+ AcountAdapter adapter=new AcountAdapter(AcountListView.this,R.layout.acount_item, acountList);
+ ListView listView=(ListView)findViewById(R.id.list_view_acount);
+ listView.setAdapter(adapter);
+ listView.setOnItemClickListener(new OnItemClickListener() {
+ public void onItemClick(AdapterView> parent, View view,int position, long id)
+ {
+ AcountData acountData = acountList.get(position);
+ Intent intent=new Intent(AcountListView.this,AcountDetails.class);//显示Intent
+ intent.putExtra("acountId", String.valueOf(acountData.getAcountId()));
+ startActivity(intent);
+ }
+ });
+ Button addAcountBtn=(Button)findViewById(R.id.addAcountBtn);
+ addAcountBtn.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View arg0) {
+ // TODO Auto-generated method stub
+ Intent intent=new Intent(AcountListView.this,AddAcount.class);//显示Intent
+ startActivity(intent);
+ }
+ });
+ }
+ private void initAcount()
+ {
+ dbHelper=new MyDatabaseHelper(this, "PasswordBox.db", null, 2);
+ SQLiteDatabase db=dbHelper.getWritableDatabase();
+ // 查询Acount表中所有的数据
+ Cursor cursor=db.rawQuery("select * from Acount", null);
+ if(cursor.moveToFirst())
+ {
+ do{
+ int id=cursor.getInt(cursor.getColumnIndex("id"));
+ String acountLabel=cursor.getString(cursor.getColumnIndex("acountLabel"));
+ AcountData acountData=new AcountData(id,acountLabel);
+ acountList.add(acountData);
+ }
+ while(cursor.moveToNext());
+ }
+ cursor.close();
+ }
+}
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AddAcount.java" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AddAcount.java"
new file mode 100644
index 00000000..1f983746
--- /dev/null
+++ "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AddAcount.java"
@@ -0,0 +1,45 @@
+package com.example.passwordbox;
+
+import android.app.Activity;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.database.sqlite.SQLiteDatabase;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+
+public class AddAcount extends Activity{
+ private MyDatabaseHelper dbHelper;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // TODO Auto-generated method stub
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.add_acount);
+ dbHelper=new MyDatabaseHelper(this, "PasswordBox.db", null, 2);
+ Button addCountBtn=(Button)findViewById(R.id.addCount);
+ addCountBtn.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View arg0) {
+ // TODO Auto-generated method stub
+ EditText userName = (EditText) findViewById(R.id.userName);
+ EditText password = (EditText) findViewById(R.id.password);
+ EditText notes = (EditText) findViewById(R.id.notes);
+ EditText acountLabel = (EditText) findViewById(R.id.acountLabel);
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ ContentValues values = new ContentValues();
+ values.put("acountLabel", acountLabel.getText().toString());
+ values.put("userName", password.getText().toString());
+ values.put("password", userName.getText().toString());
+ values.put("notes", notes.getText().toString());
+ db.insert("Acount", null, values);
+ Toast.makeText(AddAcount.this,"添加账号成功",Toast.LENGTH_LONG).show();
+ Intent intent=new Intent(AddAcount.this,AcountListView.class);//显示Intent
+ startActivity(intent);
+ }
+ });
+ }
+}
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AndroidManifest.xml" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AndroidManifest.xml"
new file mode 100644
index 00000000..606f2490
--- /dev/null
+++ "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/AndroidManifest.xml"
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/acount_listview.xml" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/acount_listview.xml"
new file mode 100644
index 00000000..afb526f0
--- /dev/null
+++ "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/acount_listview.xml"
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/add_acount.xml" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/add_acount.xml"
new file mode 100644
index 00000000..48274986
--- /dev/null
+++ "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2144/add_acount.xml"
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/Acount\350\241\250\347\273\223\346\236\204\345\233\276.png" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/Acount\350\241\250\347\273\223\346\236\204\345\233\276.png"
new file mode 100644
index 00000000..c67ac399
Binary files /dev/null and "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/Acount\350\241\250\347\273\223\346\236\204\345\233\276.png" differ
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/Login\350\241\250\347\273\223\346\236\204\345\233\276.png" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/Login\350\241\250\347\273\223\346\236\204\345\233\276.png"
new file mode 100644
index 00000000..708e928d
Binary files /dev/null and "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/Login\350\241\250\347\273\223\346\236\204\345\233\276.png" differ
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/MyDatabaseHelper.java" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/MyDatabaseHelper.java"
new file mode 100644
index 00000000..7117880b
--- /dev/null
+++ "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/MyDatabaseHelper.java"
@@ -0,0 +1,43 @@
+package com.example.passwordbox;
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteDatabase.CursorFactory;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.widget.Toast;
+
+public class MyDatabaseHelper extends SQLiteOpenHelper{
+
+ public static final String CREATE_Login="create table Login ("
+ + "id integer primary key autoincrement, "
+ + "userName text, "
+ + "password text) ";
+ public static final String CREATE_Acount="create table Acount ("
+ + "id integer primary key autoincrement, "
+ + "acountLabel text, "
+ + "userName text, "
+ + "password text,"
+ + "notes text) ";
+ private Context myContext;
+ public MyDatabaseHelper(Context context, String name,
+ CursorFactory factory, int version) {
+ super(context, name, factory, version);
+ // TODO Auto-generated constructor stub
+ myContext=context;
+ }
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ // TODO Auto-generated method stub
+ db.execSQL(CREATE_Login);
+ db.execSQL(CREATE_Acount);
+ Toast.makeText(myContext, "Create Login And Acount table Succeed", Toast.LENGTH_SHORT).show();
+ }
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+}
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\345\256\236\351\252\2146.png" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\345\256\236\351\252\2146.png"
new file mode 100644
index 00000000..edfe288f
Binary files /dev/null and "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\345\256\236\351\252\2146.png" differ
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\350\277\220\350\241\214\347\273\223\346\236\234-\347\231\273\345\275\225\345\211\215.png" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\350\277\220\350\241\214\347\273\223\346\236\234-\347\231\273\345\275\225\345\211\215.png"
new file mode 100644
index 00000000..df86ec26
Binary files /dev/null and "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\350\277\220\350\241\214\347\273\223\346\236\234-\347\231\273\345\275\225\345\211\215.png" differ
diff --git "a/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\350\277\220\350\241\214\347\273\223\346\236\234-\347\231\273\345\275\225\345\220\216.png" "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\350\277\220\350\241\214\347\273\223\346\236\234-\347\231\273\345\275\225\345\220\216.png"
new file mode 100644
index 00000000..028673b8
Binary files /dev/null and "b/app/src/main/java/edu/hzuapps/androidworks/homeworks/com1314080901208/\345\256\236\351\252\2146-sqllite\347\232\204\344\275\277\347\224\250/\350\277\220\350\241\214\347\273\223\346\236\234-\347\231\273\345\275\225\345\220\216.png" differ