The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

VitorPio217 (1) [Avatar] Offline
Hello good people from manning, i'm trying to add itens from a sqlite database to static values in another class but every time i add i dosen't seen to work at first but when i add the second item the firs is added and and so on.

Here is the code:

int id_item = position+1;

db=openOrCreateDatabase("Student"+padrao.opcao+".db", SQLiteDatabase.CREATE_IF_NECESSARY, null);
Cursor c = db.rawQuery("select id,name,age,ingredientes from Stud where id = "+id_item, null);


java.text.NumberFormat nf = java.text.NumberFormat.getNumberInstance();

String valor = nf.format(Double.parseDouble(c.getString(2))*quantidade);

String nome = c.getString(1);

String ped = "
Nome: "+ nome+ "
Valor: R$: "+valor+"

Double val = (Double.parseDouble(c.getString(2))*quantidade);

pedido.nome_e_quanidade_e_valor = pedido.nome_e_quanidade_e_valor.toString() + ped ;;




And here is the class:

public class pedido {

public static String nome_e_quanidade_e_valor="";
public static double total=0;
public static int numero_do_pedido=0;


i'll be glad if someone could help me with that.

Thaks, Vitor Pio