VideoItem item = (VideoItem) gridView.getChildAt(position);

On Jan 21, 4:03 am, "and.Freecomm" <[email protected]> wrote:
> hi there,
> Here is a GridView with custom ImageView in it.
> How can i get the sub custom ImageView from the function
> onItemClickListener ?
> It will be crashed after i get the item.
>
> onItemClickListener:
>         videosView.setOnItemClickListener(new OnItemClickListener()
>         {
>             @Override
>             public void onItemClick(AdapterView<?> parent, View view,
> int position,
>                     long id)
>             {
>                 VideoItem item =
> (VideoItem)view.findViewById(R.id.video_grid_item);
>                 if ( item != null )
>                 {
>                     item.setOverlay(R.drawable.box);
>                     Log.d(TAG, "item is not empty");
>                     mVideoAdapter.notifyDataSetChanged();
>                 }
>
>             }
>         });
>
> the  layout mail.xml:
>         <LinearLayout android:id="@+id/topLayout"
>            android:orientation="vertical"
>            android:layout_width="fill_parent"
>            android:layout_height="fill_parent"
>            android:layout_weight="1.0">
>
>         <GridView android:id="@+id/videoContent"
>                 android:drawSelectorOnTop="false"
>                 android:columnWidth="113dip"
>                 android:numColumns="auto_fit"
>                 android:cacheColorHint="#000000"
>                 android:background="#000000"
>                 android:listSelector="#000000"
>                 android:stretchMode="spacingWidthUniform"
>                 android:layout_width="fill_parent"
>                 android:layout_height="fill_parent"/>
>
> <b>the gridviewItem.xml</b>
> <LinearLayout
>   xmlns:android="http://schemas.android.com/apk/res/android";
>   android:layout_width="113dip"
>   android:orientation="vertical"
>   android:layout_height="wrap_content">
>
>   <FrameLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_centerHorizontal="true"
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content">
>
>     <videoplayer.VideoItem
>         android:id="@+id/video_grid_item"
>         android:layout_width="105dip"
>         android:layout_height="105dip"
>         android:scaleType="centerCrop"
>     />
>   </FrameLayout>
> </LinearLayout>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to