Postingan lainnya
Ada yang salahkah di code java ini
full code Answer.java https://pastebin.com/4UbM6i6E full code AnswerDataSource.java https://pastebin.com/2WWDpqMy
penggalan code, 2 class Answer dan AnswerDataSource error di Class AnswerDataSource
minta tolong bantuannya, ada yang salahkah?
public class Answer {
private String choosen_answer;
private long id;
private long question_id;
public Answer(long question_id, String choosen_answer) {
this.question_id = question_id;
this.choosen_answer = choosen_answer;
}
}
public class AnswerDataSource {
private String[] allColumns;
private SQLiteDatabase database;
private MySQLiteHelper dbHelper;
public Answer cursorToAnswer(Cursor cursor) {
Answer answer = new Answer();// error di sini (bagian kurung buka kurung tutup)
answer.setId(cursor.getLong(0));
answer.setQuestion_id(cursor.getLong(1));
answer.setChoosen_answer(cursor.getString(2));
return answer;
}
}
0
4 Jawaban:
saya ga paham Java gan, tapi kalo liat dari constructornya
public Answer(long question_id, String choosen_answer)
bukannya mestinya langsung di set pada saat fungsi cursorToAnswer() ?
Answer answer = new Answer(cursor.getLong(1), cursor.getString(2));
2
gan rachmatsasongko boleh minta alamat emailnya gk. buat pm
0
boleh di rachmatsasongko@gmail.com
0