1
I needed to get all the answers inside Boolean respostas1 and play inside another variable so I can send it to the Mysql database.
The way I did, he’s returning me all false.
For example, I have 4 questions, he should bring me: true, false, true and false...
and is returning false false false.
Why it is returning false and how to solve?
for (int x=0; x<respostas2.length; x++){
for (final String a : ids){
idPERGUNTAS = a;
}
Log.i("ID da Perguntas", "IDS das Perguntas: "+idPERGUNTAS);
//parametrosPost2.add(new BasicNameValuePair("ids", idPERGUNTAS));
for (String IDPaciente : idPacientes){
for (int i=0; i < respostas2.length; i++){
idPACIENTES = IDPaciente;
}
}
Log.i("ID do Paciente", "IDS dos Pacientes: "+idPACIENTES);
//parametrosPost2.add(new BasicNameValuePair("idNome", idPACIENTES));
for(boolean respostas1 : respostas2){
RESPOSTAS = respostas1;
}
Log.i("Resposta", "Respostas: "+RESPOSTAS);
//parametrosPost2.add(new BasicNameValuePair("respostas", String.valueOf(RESPOSTAS)));
I have 3 values that I would like to send to the database, so I understood, just this way I could send all... because there are several answers... If I put the answer inside the is, it will return me all of them so it will triple...
You could show how you fill in the values in your array
respostas2? By the way, I don’t quite understand what your question is.– Math
I’ve already edited the @Math
– Emerson Moraes
I believe that your problem of returning all false is occurring at the time of passing the values from one Activity to another, no?
– Math
Hard as it is, I already took the test. I put a Log inside the for and it returns me all right, but I needed to get the values out of the for, but then I’m having this problem of everything false
– Emerson Moraes
this answers is an array? pq if you are not assigning one on top of the other
– Joannis
ANSWERS is a Boolean...
– Emerson Moraes
if you take out of the comment the Log. i that is inside the is, and comment the Log. i that is outside, does not work?
– Math
You are using a for to take element to element of an array and put inside a boolean variable, the variable only holds a value, that is to each loop of the for you throw out the previous variable saved and assign a new one in the same place it overwrites the value.
– Joannis
It does, but I needed to get those values out of the for, if not the error... @Joannis, you’re right, he’s always getting the last answer... This assigning upon the other.. =(
– Emerson Moraes
need out of the for? put as you are reading that variable the part you are adding the parameters
– Joannis
Why out of the for? plays the go to where you assign
– Joannis