Skip to content

Commit

Permalink
Merge pull request #408 from vwuyang/master
Browse files Browse the repository at this point in the history
#5 #177 第五次实验
  • Loading branch information
zengsn authored Jun 11, 2017
2 parents 9afc675 + 2a1d98d commit e619349
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ public void onCreate(Bundle savedInstanceState, PersistableBundle persistentStat
btSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
MySQLiteHelper helper=new MySQLiteHelper(Net1414080903139AddRecordActivity.this);

Net1414080903139MySQLiteHelper helper=new Net1414080903139MySQLiteHelper(Net1414080903139AddRecordActivity.this);
SQLiteDatabase db=helper.getWritableDatabase();
ContentValues values=new ContentValues();
values.put("name",etName.getText().toString().trim());
values.put("birthday",etBirthday.getText().toString().trim());
values.put("name",etName.getText().toString().trim());
db.insert("birthday",null,values);
db.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.ArrayList;
import java.util.List;

import edu.hzuapps.andridlabs.homeworks.net1414080903139.MySQLiteHelper;
import edu.hzuapps.myapplication.R;

public class Net1414080903139CheckActivity extends AppCompatActivity {
Expand All @@ -21,8 +20,8 @@ public class Net1414080903139CheckActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_net1414080903139_check);
Net1414080903139MySQLiteHelper helper=new Net1414080903139MySQLiteHelper(this);
lv= (ListView) findViewById(R.id.lv);
MySQLiteHelper helper=new MySQLiteHelper(this);
SQLiteDatabase db=helper.getReadableDatabase();
Cursor cursor=db.query("birthday",null,null,null,null,null,null);
List<String> beans=new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package edu.hzuapps.andridlabs.homeworks.net1414080903139;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
* Created by 阳飞 on 2017/4/29.
*/

public class Net1414080903139MySQLiteHelper extends SQLiteOpenHelper {

public Net1414080903139MySQLiteHelper(Context context) {
super(context, "birthday", null, 1);
}

@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL("create table birthday(name varchar(20),birthday varchar(20));");
}

@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

}
}

0 comments on commit e619349

Please sign in to comment.