只是我test页面的代码
srbt.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
query();
// srDb.close();
}
});
}
private void query()
{
    
try{
db.createDataBase();
srDb=db.getWritableDatabase();
// Cursor cs=srDb.query(false, null, null, null, null, null, null, null, null);
String str=srText.getText().toString();
 String sql = "Select *  from chengyucidian where chengyu='"+str+"'";
Cursor cs=srDb.rawQuery(sql, null);
cs.moveToFirst();
srText.setText(cs.getString(cs.getColumnIndex("pinyin")));
System.out.println(cs.getString(cs.getColumnIndex("pinyin")));
//srDb=new copyDB(this);
// srDb=SQLiteDatabase.openOrCreateDatabase("data/data/practice.content/data.db", null);
/*
//srDb=SQLiteDatabase.openOrCreateDatabase("/assets/data.db", null);
    String str=srText.getText().toString();
 String sql = "Select *  from chengyucidian where chengyu='"+str+"'";
 Cursor cr=srDb.rawQuery(sql, null);
 cr.moveToFirst();
 //for(int i=0;i<cr.getCount()-1)
srText.setText(cr.getString(cr.getColumnIndex("pinyin")));*/
}catch(Exception e){
 Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();  
 System.out.println(e.toString());
}这是复制数据库到SDK上的代码 copyDB.class的代码
package practice.content;import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Environment;
import android.widget.Toast;public class copyDB extends SQLiteOpenHelper{ private static final int DB_VERSION=1;
private static final String DB_PATH="data/data/practice.content/";

// private static String DB_PATH=Environment.getExternalStorageDirectory()+"/data.db";
private static final String DB_NAME="data.db";
private static final String ASSETS_NAME="data.db";
private SQLiteDatabase mydb=null;
private Context mycontext;private final int ASSETS_START=101;
private final int ASSETS_END=110; public copyDB(Context context, String name, CursorFactory factory,
int version) {
super(context, name, factory, version);
// TODO Auto-generated constructor stub
this.mycontext=context;
}
public copyDB(Context context, String name,int version)
{
this(context,name,null,version);
}
public copyDB(Context context, String name)
{
this(context,name,DB_VERSION);
}
public copyDB(Context context)
{
this(context,DB_PATH+DB_NAME);
}
public void createDataBase() throws IOException{
          boolean dbExist = checkDataBase();
          if(dbExist){
              //数据库已存在,do nothing.
          }else{
              //创建数据库
              try {
                  File dir = new File(DB_PATH);
                  if(!dir.exists()){
                      dir.mkdirs();
                  }
                  File dbf = new File(DB_PATH + DB_NAME);
                  if(dbf.exists()){
                      dbf.delete();
                 }
                  SQLiteDatabase.openOrCreateDatabase(dbf, null);
                  // 复制asseets中的db文件到DB_PATH下
                  copyDataBase();
              } catch (IOException e) {
                 // throw new Error("数据库创建失败");
                //  Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();  
                  System.out.println(e+"");
              }
          }
     }
 private boolean checkDataBase(){
          SQLiteDatabase checkDB = null;
          String myPath = DB_PATH + DB_NAME;
          try{            
              checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
          }catch(SQLiteException e){
              //database does't exist yet.
           System.out.println(e+"");
          }
          if(checkDB != null){
              checkDB.close();
          }
           return checkDB != null ? true : false;
      }
   
  private void copyDataBase() throws IOException{
         //Open your local db as the input stream
           InputStream myInput = mycontext.getAssets().open(ASSETS_NAME);
         // Path to the just created empty db
          String outFileName = DB_PATH + DB_NAME;
          //Open the empty db as the output stream
         OutputStream myOutput = new FileOutputStream(outFileName);
         //transfer bytes from the inputfile to the outputfile
         byte[] buffer = new byte[1024];
           int length;
          while ((length = myInput.read(buffer))>0){
             myOutput.write(buffer, 0, length);
         }
         //Close the streams
       myOutput.flush();
          myOutput.close();
         myInput.close();
    }
//复制assets下的大数据库文件时用这个
      private void copyBigDataBase() throws IOException{
          InputStream myInput;
          String outFileName = DB_PATH + DB_NAME;
          OutputStream myOutput = new FileOutputStream(outFileName);
          for (int i = ASSETS_START; i < ASSETS_END+1; i++) {
              myInput = mycontext.getAssets().open(ASSETS_NAME + "." + i);
              byte[] buffer = new byte[1024];
              int length;
              while ((length = myInput.read(buffer))>0){
                  myOutput.write(buffer, 0, length);
              }
              myOutput.flush();
              myInput.close();
          }
          myOutput.close();
      }
      @Override
          public synchronized void close() {
             if(mydb != null){
                 mydb.close();
               }
              super.close();
          }
@Override
public void onCreate(SQLiteDatabase arg0) {
// TODO Auto-generated method stub

} @Override
public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
// TODO Auto-generated method stub

}}