forked from hzuapps/android-labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4855ba5
commit 125c7d7
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
.../edu/hzuapps/androidworks/homeworks/com1314080901208/实验6-sqllite的使用/MyDatabaseHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
} | ||
|
||
|
||
|
||
} |
Binary file added
BIN
+8.78 KB
...java/edu/hzuapps/androidworks/homeworks/com1314080901208/实验6-sqllite的使用/实验6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+304 KB
...edu/hzuapps/androidworks/homeworks/com1314080901208/实验6-sqllite的使用/运行结果-登录前.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+154 KB
...edu/hzuapps/androidworks/homeworks/com1314080901208/实验6-sqllite的使用/运行结果-登录后.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.