Android drawable swiping not working (from beginners sample code)

  • I'm fluent in java for some years now but never tried making apps. So 2 days ago I started and it was just a 20 minute work from getting android studio over setting it up in netbeans to show a hello world app on my phone. But now i'm stuck with this approach for swiping through an array of jpg's. The app gets build and started, but not displaying any of my pics. Please have a look.




    XML: array.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <resources>
    <integer-array name="pics">
        <item>@drawable/tp_001</item>
        <item>@drawable/tp_002</item>
        <item>@drawable/tp_003</item>
    </integer-array>
    </resources>

    Thank you!


    ps ich kann auch etwas antworten in deutsch verstehen.

  • I think this is your Problem: imageView.setImageResource(position);


    The position is not the resource id, so there is no image to show. But I'm wondering usually your solution should throw an exception. You should pass pics.get(i) instead of the index: AddViewFlipper(pics.get(i));

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!