WEB开发网
开发学院手机开发Android 开发 Android 数据库与MapView总结 阅读

Android 数据库与MapView总结

 2010-11-05 00:54:34 来源:WEB开发网   
核心提示:having, orderBy);return cursor;}public long insert(String table,String fields[],String values[]){SQLiteDatabase db=this.getReadableDatabase();ContentValues cv =
having, orderBy);

return cursor;

}

public long insert(String table,String fields[],String values[]){

SQLiteDatabase db=this.getReadableDatabase();

ContentValues cv =new ContentValues();

for(int i=0;i

cv.put(fields[i], values[i]);

}

return db.insert(table,null, cv);

}

public int delete(String table,String where,String[] whereValue){

SQLiteDatabase db=this.getReadableDatabase();

return db.delete(table, where, whereValue);

}

public int update(String table,String updateFields[],String updateValues[],String where,

String[] whereValue){

SQLiteDatabase db =this.getWritableDatabase();

ContentValues cv=new ContentValues();

for(int i=0;i

cv.put(updateFields[i], updateValues[i]);

}

return db.update(table, cv, where, whereValue);

}

public String getMessage(){

return message;

}

public synchronized void close(){

super.close();

}

}

package irdc.ex10_06;

import android.content.ContentValues;

import android.content.Context;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.database.sqlite.SQLiteOpenHelper;

import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class MySQLiteOpenHelper extends SQLiteOpenHelper {

public String TableNames[];

public String FieldNames[][];

public String FieldTypes[][];

public static String NO_CREATE_TABLES = "no talbes";

private String message = "";

public MySQLiteOpenHelper(Context context, String name,

CursorFactory factory, int version, String tableNames[],

String fielsNames[][], String fieldTypes[][]) {

上一页  25 26 27 28 29 30 31  下一页

Tags:Android 数据库 MapView

编辑录入:coldstar [复制链接] [打 印]
赞助商链接