使用SQLitehttp://www.ibm.com/developerworks/cn/opensource/os-cn-sqlite/
这个不错,讲的详细。
这个更好
http://blog.csdn.net/liuhe688/article/details/6715983
login中create一个database
SQLiteDatabase db = openOrCreateDatabase("buddys.db", Context.MODE_PRIVATE, null);
db.execSQL("DROP TABLE IF EXISTS person");
//创建person表
db.execSQL("CREATE TABLE person (_id INTEGER PRIMARY KEY AUTOINCREMENT, names VARCHAR, age SMALLINT)");
ContentValues cv = new ContentValues();
cv.put("names",sArray[1] );
db.insert("person", null, cv);
db.close();
然后把sArray放到table person中。
Tab2那边
String name="";
SQLiteDatabase db = openOrCreateDatabase("test.db", Context.MODE_PRIVATE, null);
Cursor c = db.rawQuery("SELECT * FROM person", null);
while (c.moveToNext()) {
int _id = c.getColumnIndex("_id");
name = c.getString(c.getColumnIndex("names"));
}
c.close();
db.close();
buddyStr=name;
cursor相当于结果集。还是用数据库好啊
buddylist