这是半成品,还有些东西以后再改吧。。
首先是MainActivity
package com.example.notes2;
import java.util.ArrayList;
import java.util.List;
//import com.tops.notes.AtyEditNote;
//import com.tops.notes.db.NotesDB;
//import com.tops.notes.AtyEditNote;
//import com.tops.notes.MainActivity;
//import com.tops.notes.db.NotesDB;
//import com.exam.database.AddActivity;
//import com.exam.database.MainActivity;
//import com.exam.database.Person;
//import com.exam.database.R;
//import com.exam.database.MainActivity.MyAdapter;
//import com.exam.database.MyOpenHelper;
//import com.exam.database.Person;
//import com.exam.database.R;
import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
public static final int REQUEST=1;
private List<Person> lists;
private MyOpenHelper myOpenHelper;
private ListView lv;
public static final String KEY_USER_ID2="KEY_USER_ID2";
public static final String KEY_USER_PASSWORD2="KEY_USER_PASSWORD2";
private MyAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lv = (ListView) findViewById(R.id.lv);
lists = new ArrayList<Person>();
myOpenHelper = new MyOpenHelper(getApplicationContext());
show();
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// Intent intent=new Intent(MainActivity.this,AddActivity.class);
// startActivityForResul