DBAdapter.javapackage com.rober.clinica_laudo;import java.io.ByteArrayOutputStream;import android.content.ContentValues;import android.content.Context;import android.database.Cursor;import android.database.SQLException;import android.database.sqlite.SQLiteDatabase;import android.graphics.Bitmap;import android.graphics.BitmapFactory;public class DBAdapter { private SQLiteDatabase database; private DbHelper dbHelper; private String[] allColumns = { dbHelper.ID, dbHelper.CODIGO, dbHelper.MEDICO, dbHelper.FUNCIONARIO, dbHelper.EXAME, dbHelper.DATA, dbHelper.VALOR }; public DBAdapter(Context context) { dbHelper = new DbHelper(context); } public void open() throws SQLException { database = dbHelper.getWritableDatabase(); } public void close() { dbHelper.close(); } public Void createLaudo(String codigo, String medico, String func, String exame, String data, String valor) { ContentValues values = new ContentValues(); values.put(dbHelper.CODIGO, codigo); values.put(dbHelper.MEDICO, medico); values.put(dbHelper.FUNCIONARIO, func); values.put(dbHelper.EXAME, exame); values.put(dbHelper.DATA, data); values.put(dbHelper.VALOR, valor); long insertId = database.insert(dbHelper.TABLE_NAME, null, values); // To show how to query Cursor cursor = database.query(dbHelper.TABLE_NAME, allColumns, dbHelper.ID + " = " + insertId, null, null, null, null); cursor.moveToFirst(); return null; } private Laudo cursorToLaudo(Cursor cursor) { Laudo laudo = new Laudo(cursor.getLong(0), cursor.getLong(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5), cursor.getString(6)); return laudo; } public Cursor getLaudos() { Cursor cursor = database.rawQuery("select " + dbHelper.ID + ", " + dbHelper.CODIGO + ", " + dbHelper.MEDICO + ", " + dbHelper.FUNCIONARIO + ", " + dbHelper.EXAME + ", " + dbHelper.DATA + ", " + dbHelper.VALOR + " from exames ORDER BY " + dbHelper.CODIGO + " desc", null); return cursor; } public Laudo getLaudo(int idLaudo) { Cursor cursor = database.query(dbHelper.TABLE_NAME, allColumns, dbHelper.CODIGO + " = " + idLaudo, null, null, null, null); cursor.moveToFirst(); return cursorToLaudo(cursor); } public Cursor getMaxLaudo() { Cursor cursor = database.rawQuery("select MAX(" + dbHelper.CODIGO + ") " + " from exames", null); return cursor; }}/*******************************************************************************/> Laudo.javapackage com.rober.clinica_laudo;public class Laudo { private long id; private long clin_func_empr_exam_codigo; private String medi_nome; private String func_empr_nome; private String exam_nome; private String clin_func_empr_exam_data_exame; private String clin_func_empr_exam_valor; public Laudo(long id, long codigo, String medico, String func,String exame,String data,String valor){ this.id=id; this.clin_func_empr_exam_codigo=codigo; this.medi_nome=medico; this.func_empr_nome=func; this.exam_nome=exame; this.clin_func_empr_exam_data_exame=data; this.clin_func_empr_exam_valor=valor; } public long getId() { return id; } public void setId(long id) { this.id = id; } public long getClin_func_empr_exam_codigo() { return clin_func_empr_exam_codigo; } public void setClin_func_empr_exam_codigo(long clin_func_empr_exam_codigo) { this.clin_func_empr_exam_codigo = clin_func_empr_exam_codigo; } public String getMedi_nome() { return medi_nome; } public void setMedi_nome(String medi_nome) { this.medi_nome = medi_nome; } public String getFunc_empr_nome() { return func_empr_nome; } public void setFunc_empr_nome(String func_empr_nome) { this.func_empr_nome = func_empr_nome; } public String getExam_nome() { return exam_nome; } public void setExam_nome(String exam_nome) { this.exam_nome = exam_nome; } public String getClin_func_empr_exam_data_exame() { return clin_func_empr_exam_data_exame; } public void setClin_func_empr_exam_data_exame( String clin_func_empr_exam_data_exame) { this.clin_func_empr_exam_data_exame = clin_func_empr_exam_data_exame; } public String getClin_func_empr_exam_valor() { return clin_func_empr_exam_valor; } public void setClin_func_empr_exam_valor(String clin_func_empr_exam_valor) { this.clin_func_empr_exam_valor = clin_func_empr_exam_valor; } }/*******************************************************************************/> LaudoAdapter.javapackage com.rober.clinica_laudo;import java.util.List;import com.rober.clinica_laudo.R;import android.annotation.SuppressLint;import android.content.Context;import android.util.Log;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.BaseAdapter;import android.widget.TextView;public class LaudoAdapter extends BaseAdapter { private Context context; private List<Laudo> laudoList; public LaudoAdapter(Context context, List<Laudo> laudoList) { this.context = context; this.laudoList = laudoList; } public int getCount() { return laudoList.size(); } public Object getItem(int position) { return laudoList.get(position); } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { // Recupera o estado da posicao atual Laudo laudo = laudoList.get(position); // Cria uma instancia do layout XML para os objetos correspondentes // na View LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.laudo_list_item, null); // Estado - Abreviacao