To access child items in Image gallery view


Last Updated:

  1. shivasr

    shivasr New Member This Topic's Starter

    Joined:
    Sep 10, 2010
    Messages:
    1
    Likes Received:
    0
    Hi,

    I want to auto select an image in gallery and focus the selected image. I know the position (index) of the image in gallery.

    I am trying to use

    in res/layout/main.xml

    <Gallery
    android:id="@+id/galleryView"
    android:layout_below="@id/imageViewMap"
    android:layout_width="fill_parent"
    android:layout_height="100sp"
    android:layout_weight="1"

    />

    in AlbumView.java

    gallery = (Gallery) mView.findViewById(R.id.galleryView);

    ImageView view = gallery.getItemAtPosition(position);

    Unfortunately the above code is returning null.

    Can you please help in this matter.
     

    Advertisement
  2. Steven58

    Steven58 Reformed PH VIP Member

    Joined:
    Feb 19, 2010
    Messages:
    32,920
    Likes Received:
    25,271
    Welcome to Android Forums! Glad you signed up!

    I'll move this to where folks will see it.
     
    shivasr likes this.

Share This Page

Loading...