Android Development Tutorial – Drink Shop App part 6 Load Drinks List



Donation link:
Facebook :
Link assets: (DB static)
#DrinkShopAndroidEDMTDev #AndroidEDMTDev #EDMTDev
In this video, I will write how to get drinks from Server and display them on our Android app

We will try to build a drink order with Shop back PHPend

Android development tutorial, Android programming ….

36 Comments

  1. Reply

    Hi sir. Only toppings image is displaying and not other. I tried the link on browser too but it is not working there too. Can you please look into the problem? Thanks.

  2. Reply

    Your tutorials are great EDMT. I some questions though. Firstly, I managed to follow this tutorial and everything is working perfectly. I now want to be able to access the app using my android device via wifi on same network as well as over internet, how can I go about doing this. Secondly, you seem to code and solve errors instantly, and I won't lie, half the time I don't even understand the code you're typing, i'm merely copying and pasting lol. How did you get so good at knowing the different aspects of android. Regards.

  3. Reply

    Hello Sir will you please help me ???
    I am trying to pass 1st activity's recyclerview position and 2nd activity's recyclerview position together in 3rd activity.

    public static Car currentCars= null; (this stores1st recyclerview position)

    public static Bike currentBike= null;(this stores 2nd recyclerview position)

    From MainActivity when I am going to second activity I have passed the position

    public static Car currentCars= null; /*this stores 1st recyclerview position , Which is in Main Activity*/

    context.startActivity(new Intent(context, SecondActivity.class));

    and From second activity when I am going to third activity I have passed the position

    public static Bike currentBike= null; /*this stores 2nd recyclerview position, which is in SecondActivity*/

    context.startActivity(new Intent(context, ThirdActivity.class));

    On the ThirdActivity.Class My Code is like this

    loadCars(Common.currentCars.ID,Common.currentBike.ID);

    }

    private void loadCars(String carID, String bikeID) {

    Observable<List<Allvehicle>> observable = apiClass.getAllVehicle(carID,bikeID)

    .subscribeOn(Schedulers.io())

    .observeOn(AndroidSchedulers.mainThread());

    observable.subscribe(new Observer<List<Allvehicle>>() {

    @Override

    public void onSubscribe(Disposable d) {

    }

    @Override

    public void onNext(List<Allvehicle> allVehicle) {

    showAllVehicle(allVehicle);

    }

    @Override

    public void onError(Throwable e) {

    showErrorMassage(e.getMessage());

    }

    @Override

    public void onComplete() {

    }

    });

    }

    private void showErrorMassage(String message) {

    Toast.makeText(this, message, Toast.LENGTH_LONG).show();

    }

    private void showAllVehicle(List<Allvehicle> allVehicle) {

    AllVehicleAdapter adapter = new AllVehicleAdapter(this,allVehicle);

    recyclerView.setAdapter(adapter);

    }

    It show error on Toast massage : Expected BEGIN_ARRAY but was BEGIN_OBJECT al line 4 column 2 path $

  4. Reply

    Can you please teach me how to add back button at the top , so that it can back to home activity. I badly need it thank you

  5. Reply

    please help!!!!!
    when I click, the application stops. what it shows me in the logcat is the following:
    E/AndroidRuntime: FATAL EXCEPTION: main

    Process: google.cajamarca.peru.appgasstation, PID: 2165 io.reactivex.exceptions.OnErrorNotImplementedException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

    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:77)

  6. Reply

    Hi sir
    Why this drink appear?

    io.reactivex.exceptions.OnErrorNotImplementedException: failed to connect to zannnbil.ir/5.135.243.145 (port 80) after 10000ms

    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:77)

    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:733)

    at android.os.Handler.dispatchMessage(Handler.java:95)

    at android.os.Looper.loop(Looper.java:136)

    at android.app.ActivityThread.main(ActivityThread.java:5333)

    at java.lang.reflect.Method.invokeNative(Native Method)

    at java.lang.reflect.Method.invoke(Method.java:515)

    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:711)

    at dalvik.system.NativeStart.main(Native Method)

    I use from this code to handle sockettime out:
    final OkHttpClient okHttpClient=new OkHttpClient.Builder().readTimeout(100, TimeUnit.SECONDS).connectTimeout(100,TimeUnit.SECONDS).build();

  7. Reply

    hi sir. in my project i used your concept in this tutorial, but why cardview don't match the parent size(screen). my data is from database and if it has few letters for example in the title property, it will not match the size of the parent. Can you give me idea why? thanks. Have a good day

  8. Reply

    anh ơi. Anh có thể giải thích 1 chút về cơ chế của cái phần ViewHolder được không ạ? Em làm theo thì thành công nhưng vẫn chưa hiểu rõ là làm sao mà mấy cái View ấy có thể gọi đến nhau cũng như là gọi đúng cái layout mình cần dùng. Cảm ơn anh trước

  9. Reply

    by test ARC this error popup. <b>Fatal error</b>: Call to a member function fetch_assoc() on boolean in <b>M:xampphtdocsbakkerijdb_functions.php</b> on line <b>134</b><br />

  10. Reply

    Hello sir, I need to display the same image drink that has been clicked on, on the menu activity instead of your banner drink, how to do this ?

  11. Reply

    Hi bro

    your app has a big bug.

    when the connection is weak your projects has crashed because of there isn't any handler to control this bug and for this reason the socket time out error has appear and crashes app.

    this bug is in any activities for example:

    Home activity

    Drink Activity

    Search Activity

    Card Activity

  12. Reply

    khi click vào Menu sản phẩm thì crash và Causeby thì thấy Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ ?? lỗi này là gì vậy a

  13. Reply

    io.reactivex.exceptions.OnErrorNotImplementedException:
    The exception was not handled due to missing onError handler in the subscribe() method call

    bro when iam clicking on product menu app crash with this logcat

  14. Reply

    Hi EDMT Dev.. I just want to ask if what might be the problem on getting null values from drinklist? i used Advenced Rest client and data are retrieved but when i traced the bug in the android and this don't seem to work right since i have null on the list. Adapter works fine though but showing null. Can you help me please 🙂
    @FormUrlEncoded
    @POST("getdrink.php")
    Observable<List<Drink>> getDrink(@Field("menuid") String menuid);

  15. Reply

    When the wifi is connected without internet and I clicked any of the items its shows this error

    com.example.mahmood.demo2 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.mahmood.demo2, PID: 4134
    io.reactivex.exceptions.OnErrorNotImplementedException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
    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:77)
    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:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:207)
    at android.app.ActivityThread.main(ActivityThread.java:5728)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
    Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
    at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1568)
    at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1409)
    at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:593)
    at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:74)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
    at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
    at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
    at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:122)
    at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:217)
    at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
    at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:42)
    at io.reactivex.Observable.subscribe(Observable.java:11194)
    at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
    at io.reactivex.Observable.subscribe(Observable.java:11194)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:463)
    at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
    at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)

  16. Reply

    Everything is good 🙂 just i have query why dirnk endpoint response is POST method? I think it should be get request. Because,
    all data get form db. thanks

  17. Reply

    Thank you so much master! Your videos are awesome!
    I'd like to learn brining menu from database with scanning QR Code + Payment.
    'WhatsApp' using this.
    Thank you!

  18. Reply

    Hi Sir,
    when i click on the item it keeps crashing and stop
    here is logcat:
    06-25 00:08:15.092 18523-18523/co.k.kitchen E/AndroidRuntime: FATAL EXCEPTION: main
    Process: co.k.kitchen, PID: 18523
    io.reactivex.exceptions.OnErrorNotImplementedException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
    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:77)
    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:164)
    at android.app.ActivityThread.main(ActivityThread.java:6649)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
    Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
    at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:80)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
    at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:37)
    at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:25)
    at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:119)
    at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:218)
    at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
    at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:41)
    at io.reactivex.Observable.subscribe(Observable.java:10981)
    at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
    at io.reactivex.Observable.subscribe(Observable.java:10981)
    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:66)
    at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
    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)

  19. Reply

    Hi man…
    you are the best teacher in the world, I love you
    i want a request
    please don't use FIreBase In this app, because firebase doesn't let me to use. I'm iranian and we can't use firebase. firebase is so usefull but we can't use

Leave Comment

Your email address will not be published. Required fields are marked *