Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
package com.basedados; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.List; 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 final DbHelper dbHelper; private String[] allColumns = { DbHelper.ID, DbHelper.NOME, DbHelper.DES}; private String[] allColumns1 = {DbHelper.ID, DbHelper.NOME, DbHelper.CAT, DbHelper.PAIS, DbHelper.LAT, DbHelper.LON, DbHelper.FOTO}; public DBAdapter(Context context) { dbHelper = new DbHelper(context); } public void open() throws SQLException { database = dbHelper.getWritableDatabase(); } public void close() { dbHelper.close(); } //M├ętodos para a tabela Categorias public Categoria createCategoria(String nome, String des) { ContentValues values = new ContentValues(); values.put(DbHelper.NOME, nome); values.put(DbHelper.DES, des); long insertId = database.insert(DbHelper.CATEGORIAS, null, values); // To show how to query Cursor cursor = database.query(DbHelper.CATEGORIAS, allColumns, DbHelper.ID + " = " + insertId, null,null, null, null); cursor.moveToFirst(); return cursorToCategoria(cursor); } public void EliminaCategoria (int idContacto){ //database.delete(DB.TABLE_NAME, "id=?", new String [] {Integer.toString(idContacto)}); database.delete(DbHelper.CATEGORIAS, DbHelper.ID + " = " + idContacto, null); } public int updateCat(String nome, String des) { ContentValues values = new ContentValues(); values.put(DbHelper.NOME, nome); values.put(DbHelper.DES, des); return database.update(DbHelper.CATEGORIAS, values, DbHelper.ID + " = ?", new String[] { DbHelper.ID}); } private Categoria cursorToCategoria(Cursor cursor) { Categoria categoria = new Categoria(cursor.getLong(0),cursor.getString(1), cursor.getString(2)); return categoria; } public Cursor getCategoria(){ Cursor cursor = database.rawQuery("select _id, nome, des from categorias", null); return cursor; } public Categoria getCategoria (int idContacto){ Cursor cursor = database.query(DbHelper.CATEGORIAS, allColumns, DbHelper.ID + " = " + idContacto, null,null, null, null); cursor.moveToFirst(); return cursorToCategoria(cursor); } public List getAllCat() { List dados = new ArrayList(); // Select All Query String selectQuery = "SELECT * FROM " + DbHelper.CATEGORIAS; database = dbHelper.getReadableDatabase(); Cursor cursor = database.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { dados.add(cursor.getString(1)); } while (cursor.moveToNext()); } // closing connection cursor.close(); database.close(); return dados; } //Base de Dados Locais public Locais createLocal(String nome, String cat, String pais, String lat, String lon, Bitmap foto) { ContentValues values = new ContentValues(); values.put(DbHelper.NOME, nome); values.put(DbHelper.CAT, cat); values.put(DbHelper.PAIS,pais); values.put(DbHelper.LAT,lat); values.put(DbHelper.LON,lon); ByteArrayOutputStream baos = new ByteArrayOutputStream(); foto.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] photo = baos.toByteArray(); values.put(DbHelper.FOTO, photo); long insertId = database.insert(DbHelper.TABLE_NAME, null, values); // To show how to query Cursor cursor = database.query(DbHelper.TABLE_NAME, allColumns1, DbHelper.ID + " = " + insertId, null,null, null, null); cursor.moveToFirst(); return cursorToLocal(cursor); } public void EliminaLocal (int idContacto){ database.delete(DbHelper.TABLE_NAME, DbHelper.ID + " = " + idContacto, null); } public int updateLocal(String nome, String cat, String pais, String lat, String lon, Bitmap foto) { ContentValues values = new ContentValues(); values.put(DbHelper.NOME, nome); values.put(DbHelper.CAT, cat); values.put(DbHelper.PAIS,pais); values.put(DbHelper.LAT,lat); values.put(DbHelper.LON,lon); ByteArrayOutputStream baos = new ByteArrayOutputStream(); foto.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] photo = baos.toByteArray(); values.put(DbHelper.FOTO, photo); // updating row return database.update(DbHelper.TABLE_NAME, values, DbHelper.ID + " = ?", new String[] { DbHelper.ID}); } private Locais cursorToLocal(Cursor cursor) { byte[] blob = cursor.getBlob(cursor.getColumnIndex(DbHelper.FOTO)); Bitmap bmp = BitmapFactory.decodeByteArray(blob, 0, blob.length); Locais locais = new Locais(cursor.getLong(0),cursor.getString(1),cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5),bmp); return locais; } public Cursor getLocais(){ Cursor cursor = database.rawQuery("select _id, nome, cat, pais, lat, lon, foto from locais", null); return cursor; } public Locais getLocal (int idContacto){ Cursor cursor = database.query(DbHelper.TABLE_NAME, allColumns1, DbHelper.ID + " = " + idContacto, null,null, null, null); cursor.moveToFirst(); return cursorToLocal(cursor); } }