Android SQLite 相关

我想创建2个表这样对吗?

public class MyDatabaseHelper extends SQLiteOpenHelper {

private String CREATE_TABLE_USER = "create table USER(" + "username text,"
    + "usermima text," + ")";

private String CREATE_TABLE_STU = "create table STU(" + "id text,"
    + "name text," + "num text," + ")";

public MyDatabaseHelper(Context context, String name,
    CursorFactory factory, int version) {
super(context, name, factory, version);

}

@Override
public void onCreate(SQLiteDatabase arg0) {
arg0.execSQL(CREATE_TABLE_USER);
arg0.execSQL(CREATE_TABLE_STU);

}

    我在MainActivity中

private MyDatabaseHelper myhelper;

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    myhelper = new MyDatabaseHelper(MainActivity.this, "UserDB.db", null, 1);

    myhelper.getWritableDatabase();


    可以用第一张表USER ,但是在第二个Activity中要怎么才能对第二张表STU进行增删改查操作呢 求帮忙

就你的需求
private String CREATE_TABLE_USER = "create table USER(" + "username text,"

  • "usermima text," + ")"; 可以简化为 private String CREATE_TABLE_USER = "create table USER(username text,usermima text)";

你完全没概念,先参考下
http://www.2cto.com/kf/201406/308217.html
http://www.linuxidc.com/Linux/2011-12/49929.htm