Open rifqizain opened 5 years ago
bisa di copypaste di sini log nya atau dilampirkan? agar lebih jelas saya lihat errornya
D/ContentValues: loadToken: 38 loadToken: 9 loadToken: 38 E/RecyclerView: No adapter attached; skipping layout E/RecyclerView: No adapter attached; skipping layout
nah di homefragment itu gak mau tampil data keluar notif di apk nya "exceptions occurred"
W/System.err: io.reactivex.exceptions.OnErrorNotImplementedException: 2 exceptions occurred.
W/System.err: at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:74)
at io.reactivex.internal.operators.observable.ObservableZip$ZipCoordinator.checkTerminated(ObservableZip.java:239)
at io.reactivex.internal.operators.observable.ObservableZip$ZipCoordinator.drain(ObservableZip.java:170)
at io.reactivex.internal.operators.observable.ObservableZip$ZipObserver.onError(ObservableZip.java:283)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.checkTerminated(ObservableObserveOn.java:276)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:172)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:252)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: io.reactivex.exceptions.CompositeException: 2 exceptions occurred.
at io.reactivex.internal.operators.observable.ObservableOnErrorNext$OnErrorNextObserver.onError(ObservableOnErrorNext.java:94)
at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onError(BodyObservable.java:72)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:55)
W/System.err: at io.reactivex.Observable.subscribe(Observable.java:10842)
at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at io.reactivex.internal.operators.observable.ObservableOnErrorNext.subscribeActual(ObservableOnErrorNext.java:38)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:452)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:61)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:52)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: io.reactivex.exceptions.CompositeException$CompositeExceptionCausalChain: Chain of Causes for CompositeException In Order Received =>
W/System.err: at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:364)
at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:74)
at io.reactivex.internal.operators.observable.ObservableZip$ZipCoordinator.checkTerminated(ObservableZip.java:239)
at io.reactivex.internal.operators.observable.ObservableZip$ZipCoordinator.drain(ObservableZip.java:170)
at io.reactivex.internal.operators.observable.ObservableZip$ZipObserver.onError(ObservableZip.java:283)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.checkTerminated(ObservableObserveOn.java:276)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:172)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:252)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:37)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:25)
W/System.err: at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:118)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:212)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:41)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at io.reactivex.internal.operators.observable.ObservableOnErrorNext.subscribeActual(ObservableOnErrorNext.java:38)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:452)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:61)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:52)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
... 20 more
W/System.err: Caused by: java.lang.RuntimeException: Can't toast on a thread that has not called Looper.prepare()
at android.widget.Toast$TN.
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1 path $
coba kamu cek lagi endpoint yang di-consume di halaman tersebut
Oke bang, mksh Itu eror nya di adapternya bukan ya? Atau emg fragmen ny pas manggil adapternya gak jd?
itu tidak bisa nge parsing response dari server, coba cek keinginan client(android) responsenya apa, sedangkan yang dilempar dari server seperti apa. struktur JSONnya ada yang kelewat
Oke mkasih bang sudah bisa..hehe Satu lg pertanyaan bang, Nah ketika saya input soal misal kan ada 8, Terus saya bikin exam nya soal nya 5 dr 8 soal itu... Tp kok di android tetep muncul 8 soal ya bang, Padahal kn harusnya cuma 5... Terimkasih sebelumnya
Cek aja di endpointnya, harus tinggal ditambahkan / diubah query buat ngambil soalnya.
Oke bang makasih ilmu nya
bang mau tanya, untuk endpointnya saya belum nemu nih... bisa di bantu bang untuk penambahan atau perubahannya? terima kasih sebelumnya
yang masih bingung yang mana bang?
Jadi gini bang, Biar di androidnya ketika mulai exam itu hasil nya di bagi jumlah total soal, Sedangkan yg ini kan hasilnya masih dibagi jumlah soal yg dikerjakan, Misal ada 10 soal kita kerjakan 5 soal saja dan benar 3 soal, Hasilnya bukan 3 dibagi 10 melainkan 3 dibagi 5 jadinya bang
public function passexam_post() { $headers = $this->input->request_headers(); if (array_key_exists('Authorization', $headers) && !empty($headers['Authorization'])) { $decodedToken = AUTHORIZATION::validateToken($headers['Authorization']); if ($decodedToken != false) { if (!is_null($decodedToken->id)) { $data = json_decode(file_getcontents('php://input')); // Jumlah Soal $totalcorrect = 0; $update = ""; $updatesoal_ = ""; $arraybobot = array(); $arraynilai = array();
foreach ($data->hasil as $value){
$jawaban = empty($value->jawab) ? "" : $value->jawab;
$soalid = $value->soal_id;
$cekanswer = $this->db->query("SELECT bobot, jawaban FROM m_soal WHERE id = '".$soalid."'")->row();
$bobot = $cekanswer->bobot;
$arraybobot[$bobot] = empty($arraybobot[$bobot]) ? 1 : $arraybobot[$bobot]+1;
$qu_soal = "";
# Benar
if ($cekanswer->jawaban == $jawaban){
$totalcorrect++;
$arraynilai[$bobot] = empty($arraynilai[$bobot]) ? 1 : $arraynilai[$bobot]+1;
$qu_soal = "UPDATE m_soal SET jml_benar = jml_benar + 1 WHERE id = '".$soalid."'";
}else{
# Salah
$arraynilai[$bobot] = empty($arraynilai[$bobot]) ? 0 : $arraynilai[$bobot];
$qu_soal = "UPDATE m_soal SET jml_salah = jml_salah + 1 WHERE id = '".$soalid."'";
}
$update_ .= "".$soalid.":".$jawaban.",";
$updatesoal_ .= "".$soalid.",";
}
// Perhitungan Nilai Bobot
ksort($arraybobot);
ksort($arraynilai);
$nilaibobotbenar = 0;
$nilaibobottotal = 0;
foreach ($arraybobot as $key => $value){
$nilaibobotbenar = $nilaibobotbenar + ($key * $arraynilai[$key]);
$nilaibobottotal = $nilaibobottotal + ($key * $arraybobot[$key]);
}
$total_soal = count($data->hasil);
$update_ = substr($update_, 0, -1);
$updatesoal_ = substr($updatesoal_, 0, -1);
$nilai = ($totalcorrect/$total_soal) * 100;
$nilai_bobot = ($nilaibobotbenar/$nilaibobottotal) *100;
// Update Data
$time_mulai = date('Y-m-d H:i:s');
$query = $this->db->query("INSERT INTO tr_ikut_ujian SET jml_benar = ".$totalcorrect.", nilai_bobot = ".$nilai_bobot.", nilai = '".$nilai."', list_jawaban = '".$update_."', status = 'N', id_tes = '".$data->exam_id."', id_user = '".$data->user_id."', tgl_mulai='".$time_mulai."', tgl_selesai='".$time_mulai."', list_soal='".$updatesoal_."'");
if ($query){
$response = array(
"status" => true,
"message" => "Success",
"examreport" => array(
"correct" => $totalcorrect,
"grade" => $nilai,
"grade_weight" => $nilai_bobot,
"total_exam" => $total_soal
)
);
ini yang bingung di bagian $total_soal bang, jadi dia ambilnya jumlah total soal terjawab saja, bukan jumlah total soal sebenarnya
Mas mau tanya rxjava error setekah login msuk menu dashboard... io.reactivex.exceptions.onerrornotimplementedexception Kira apanya yg salah ya? Mksh