16 thoughts on “How to Use RecyclerView in Android Studio 2017 (Part 5): Connect Android with PHP & MySQL

  • November 5, 2017 at 13:01
    Permalink

    Hey KosalGeek, first of all thank you for your videos. you are more helpful than some of the native-english speaking videos online. i have a problem with the response, i get an error "Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1"..i checked my JSON Malform…my notepad++ encode menu option already has "encode in UTF-8" highlited…what can be the problem? this is my JSON response in my LOG.

    {"0":{"p_id":"4","name":"shaver","quantity":"6","price":"50","image_url":"img/image1.jpg"},"success":true,
    "1":{"p_id":"3","name":"toy","quantity":"5","price":"5","image_url":"img/image8.jpg"},
    "2":{"p_id":"2","name":"cat","quantity":"2","price":"200","image_url":"img/image3.jpg"},
    "3":{"p_id":"1","name":"dog","quantity":"1","price":"800","image_url":"img/image6.jpg"}}

  • November 5, 2017 at 13:01
    Permalink

    Hello!
    Thank you very much for your lessons.
    But I need your help. I get a Json-string from the server, but when I start the application in CardView, only one TextView is displayed. Neither the picture, nor other TextView from my xml layout is not displayed.

  • November 5, 2017 at 13:01
    Permalink

    Hello!
    I need a help because i am receiving the following error:
    Cold swapped changes.
    $ adb shell am start -n "database.cardview.recyclerviewdemo/database.cardview.recyclerviewdemo.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
    Connected to process 4575 on device Nexus_5_API_23_x86 [emulator-5554]
    I/art: Not late-enabling -Xcheck:jni (already on)
    W/System: ClassLoader referenced unknown path: /data/app/database.cardview.recyclerviewdemo-3/lib/x86
    I/InstantRun: Instant Run Runtime started. Android package is database.cardview.recyclerviewdemo, real application class is null.
    W/System: ClassLoader referenced unknown path: /data/app/database.cardview.recyclerviewdemo-3/lib/x86
    W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
    D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true

    [ 02-16 16:28:23.895 4575: 4575 D/ ]
    HostConnection::get() New Host Connection established 0xa2956700, tid 4575

    [ 02-16 16:28:23.899 4575: 4575 W/ ]
    Process pipe failed

    [ 02-16 16:28:23.952 4575: 4598 D/ ]
    HostConnection::get() New Host Connection established 0xa2956d40, tid 4598
    I/OpenGLRenderer: Initialized EGL, version 1.4
    E/EGL_emulation: tid 4598: eglSurfaceAttrib(1165): error 0x3009 (EGL_BAD_MATCH)
    W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaaa0c5a0, error=EGL_BAD_MATCH
    E/RecyclerView: No adapter attached; skipping layout
    E/RecyclerView: No adapter attached; skipping layout
    D/MainActivity: com.android.volley.TimeoutError
    E/EGL_emulation: tid 4598: eglSurfaceAttrib(1165): error 0x3009 (EGL_BAD_MATCH)
    W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaff06d20, error=EGL_BAD_MATCH
    V/RenderScript: 0xa173e000 Launching thread(s), CPUs 2
    E/Surface: getSlotFromBufferLocked: unknown buffer: 0xae3f1690
    Application terminated.

  • November 5, 2017 at 13:01
    Permalink

    SkImageDecoder::Factory returned null this is the error I am getting. it loads the image from drawable and then all images disappear. I think it could be the + product.ivImg. !!!!!!!!!!!!!!!!!!!!!! OK FIXED the problem was in the database I added the images/name of image.jpg in the db then in the android path I added images/ So the url would be images/images/pic.jpg

  • November 5, 2017 at 13:01
    Permalink

    Thank you so much for your tutorials. But i have a little problem. I connected my client to database, it works, but images don't download from db. All items on client show drawable/pp picture. Maybe it's happen because i run a project on my smartphone. I don't use a genymotion . I hope u can help me.
    P.S. Also I chanched path image url on my database like http://myip/customer/img/image1.jpg but it still doesn't work.
    P.S.S. sorry for my question, i found my mistake, it was incorrect ip address on product adapter))

  • November 5, 2017 at 13:01
    Permalink

    rocess: com.wytemagic.anew.wytemagic, PID: 11772
    com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 8.3 at line 4 column 22
    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:241)
    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:231)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
    at com.google.gson.Gson.fromJson(Gson.java:803)
    at com.google.gson.Gson.fromJson(Gson.java:768)
    at com.google.gson.Gson.fromJson(Gson.java:717)
    at com.kosalgeek.android.json.JsonConverter.toArrayList(JsonConverter.java:42)
    at com.wytemagic.anew.wytemagic.Home.onResponse
    how to fix this???

  • November 5, 2017 at 13:01
    Permalink

    i used your exemple but igot an error
    com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1

Leave a Reply