1. Download our Official Android App: Forums for Android!

To access child items in Image gallery view

Discussion in 'Android Lounge' started by shivasr, Sep 10, 2010.

  1. shivasr

    shivasr Lurker
    Thread Starter
    Rank:
    None
    Points:
    25
    Posts:
    1
    Joined:
    Sep 10, 2010

    Sep 10, 2010
    1
    0
    25
    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
    Rank:
     #4
    Points:
    3,933
    Posts:
    32,959
    Joined:
    Feb 19, 2010

    Feb 19, 2010
    32,959
    25,351
    3,933
    Male
    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...