SQLite数据库存储
项目中,我用的是ormlite框架, 等后期我把操作步骤搬上来.
1 导入jar
ormlite-android-4.43.jar
ormlite-core-4.43.jar  
2 创建实体类
3 创建Dao
4 创建DaoImpl
5 创建DatabaseHelper
6 修改MainActivity代码,做测试
import android.app.Activity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.Toast;
import com.yassblog.db.table.DoctorInfo;
import com.yassblog.db.table.PatientInfo;
public class MainActivity extends Activity {
    private EditText edit;
    private MainService mainService;
    
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        edit = (EditText) findViewById(R.id.edit);
        mainService = new MainService(getApplicationContext(), null);
        // 读取数据
        PatientInfo patientInfo = mainService.searchPatient2("abcd");
        if (patientInfo != null) {
            edit.setText(patientInfo.getPatientmobile());
            edit.setSelection(patientInfo.getPatientmobile().length());
            Toast.makeText(this, "读取成功", 0).show();
        }
    }
    
    protected void onDestroy() {
        super.onDestroy();
        // 保存数据
        DoctorInfo doctorinfo = new DoctorInfo();
        doctorinfo.setDoctorkey("123");
        doctorinfo.setDoctorid("1234");
        mainService.saveDoctorInfo(doctorinfo);
        PatientInfo patientInfo = new PatientInfo();
        patientInfo.setPatientkey("abc");
        patientInfo.setPatientmobile("abcd");
        mainService.savePatientInfo(patientInfo);
    }
}