There is a way to make GridView without Adapter ( e.g. something
like .addView() method ) ?

On 27 апр, 21:38, Illidane <illid...@gmail.com> wrote:
> My GridView shows all 100 cells on the screen ( all visible at one
> moment )
> and all the animation works fine, and pretty fast ( on all 100
> elements ),
> but than begin problems with last cell.
> Animation not child-view's. Each cell is a imageView with animation on
> it.
>
> On 27 апр, 20:43, Streets Of Boston <flyingdutc...@gmail.com> wrote:
>
>
>
> > It's not buggy. I use the adapters and grid/list-views in my apps and
> > they work fine. I think they are not designed for your purpose.
>
> > e.g. If your adapter has 100 elements and the grid/list-view only
> > shows about 15 at a time on the screen, the getView is called about 15
> > times. Sometimes more times, depending whether a little bit (a few
> > pixels) of the top or bottom child-view become visible or not. Then,
> > when you start scrolling, getView gets called again and again when
> > child-views become visible and others become invisible.
>
> > Also, seriously consider re-using the convertView for your grid- or
> > list-view. My experience is that it can really slow down your app if
> > you just return new View instances for each child-view/cell:
> > public ... getView(....) {
> >   View view = convertView != null ? convertView : createNewView(...);
> >   ...
> >   ...
> >   return view;
>
> > }
>
> > The implementation of the adapter+listviews does not need to rely on
> > the order in which the getView is called. As long as it is called for
> > every child-view that becomes visible.
>
> > Isn't is possible to start a child-view's (cell's) animation when you
> > handle it the getView(...) method?
>
> > If you really want at least 100 child-views/cells to be created (i
> > won't recommend it... it's a LOT), you can override the Adapter's
> > getViewTypeCount() and getItemViewType(int pos). Even with this, I'm
> > still not sure if getView would get called in the order you want.
>
> > ...
> >   private static int EXPECTED_CELL_COUNT = 100;
>
> >   public int getViewTypeCount() { return EXPECTED_CELL_COUNT; }
> >   public int getItemViewType(int pos) { return pos %
> > EXPECTED_CELL_COUNT; }
>
> > On Apr 27, 1:07 pm, Illidane <illid...@gmail.com> wrote:
>
> > > And you think it's not a bug? where is guarantee that it will work in
> > > general?
> > > Where adapter takes it's magic number N?
>
> > > On 27 апр, 19:56, Romain Guy <romain...@google.com> wrote:
>
> > > > There is no guarantee it's going to be called N times either.
>
> > > > 2009/4/27 Illidane <illid...@gmail.com>:
>
> > > > > Even with convertView problem is still same - last cell is not
> > > > > animating.
> > > > > And... you said WHEN getView()... I think it's no matter, matter HOW
> > > > > MANY times getView() called.
> > > > > It calls more than 100 times, whats very strange.
> > > > > For the first time it's called 102 times and all animations was
> > > > > working. For the second and next times it was 101, and last animation
> > > > > was static.
> > > > > I think where is some bug regularity...
>
> > > > > On 27 апр, 19:31, Romain Guy <romain...@google.com> wrote:
> > > > >> You should ALWAYS reuse the convertView, oherwise you're gonna eat up
> > > > >> memory and just slow down your app. And like I said, there is no
> > > > >> guarantee on how and when getView() is called so you cannot rely on 
> > > > >> it
> > > > >> with your anim counter.
>
> > > > >> 2009/4/27 Illidane <illid...@gmail.com>:
>
> > > > >> > I dont use convertView parametr and return new child-view.
>
> > > > >> > Each cell has an animation. In the getView I generate an array of
> > > > >> > animations, wich I start when the adapter stops his work ( e.g. 
> > > > >> > when
> > > > >> > my mAnimCounter == 102 ( but need be max 100, lol ) When I run app,
> > > > >> > all 100 cells are animated. But when I re-check the field as I need
> > > > >> > and call mGameGrid.setAdapter(mAdapter), new animations working, 
> > > > >> > but
> > > > >> > last. Last cell are NOT animated. Problem can be only in getView 
> > > > >> > and
> > > > >> > method how it works. I very doubt that it's not a bug of GridView 
> > > > >> > or
> > > > >> > Adapter.
>
> > > > >> > On 27 апр, 18:59, Streets Of Boston <flyingdutc...@gmail.com> 
> > > > >> > wrote:
> > > > >> >> The child/item-views in list-views and grid-views are re-used
> > > > >> >> (convertView input parameter). I suspect that depending on the 
> > > > >> >> layout/
> > > > >> >> measurements/visibility of the child-views and the way you 
> > > > >> >> implement
> > > > >> >> getView (re-using convertView or ignoring it and returning a 
> > > > >> >> brand-new
> > > > >> >> child-view every time), the order in which these child-views are
> > > > >> >> called (value of 'position' parameter in the getView method) can 
> > > > >> >> be
> > > > >> >> random.
>
> > > > >> >> On Apr 27, 11:30 am, Illidane <illid...@gmail.com> wrote:
>
> > > > >> >> > Why number of getView calls is different??
> > > > >> >> > One time it's 102 ( but need to be 100 ) and the second and 
> > > > >> >> > greater is
> > > > >> >> > 101.
>
> > > > >> >> > On 27 апр, 18:15, Romain Guy <romain...@google.com> wrote:
>
> > > > >> >> > > It's not a bug. There's no guarantee in the order of the 
> > > > >> >> > > calls wrt to
> > > > >> >> > > the position value. It also depends on how the GridView is
> > > > >> >> > > measured/laid out.
>
> > > > >> >> > > On Mon, Apr 27, 2009 at 6:38 AM, Illidane 
> > > > >> >> > > <illid...@gmail.com> wrote:
>
> > > > >> >> > > > Hi,
> > > > >> >> > > > I'm using GridView in my app, and myAdapter ( extends 
> > > > >> >> > > > BaseAdapter) for
> > > > >> >> > > > it. I have overrited method getView(int position, View 
> > > > >> >> > > > convertView,
> > > > >> >> > > > ViewGroup parent) of Adapter and 100 cells in GridView.
>
> > > > >> >> > > > If I set logger:
> > > > >> >> > > > android.util.Log.w("bla", (new StringBuilder()).append
> > > > >> >> > > > (position).toString()); where is in the getView then I'll 
> > > > >> >> > > > see that
> > > > >> >> > > > position is changed like: 0, 0, 1, 2, 3... 99, 0. -WTF? ( 
> > > > >> >> > > > thats for
> > > > >> >> > > > the first time) and then I call 
> > > > >> >> > > > mGameGrid.setAdapter(mAdapter) and
> > > > >> >> > > > position is going: 0, 0, 1, 2, 3...99.
> > > > >> >> > > > I think it's a bug of BaseAdapter, isn't it?
>
> > > > >> >> > > --
> > > > >> >> > > Romain Guy
> > > > >> >> > > Android framework engineer
> > > > >> >> > > romain...@android.com
>
> > > > >> >> > > Note: please don't send private questions to me, as I don't 
> > > > >> >> > > have time
> > > > >> >> > > to provide private support.  All such questions should be 
> > > > >> >> > > posted on
> > > > >> >> > > public forums, where I and others can see and answer them- 
> > > > >> >> > > Hide quoted text -
>
> > > > >> >> > - Show quoted text -
>
> > > > >> --
> > > > >> Romain Guy
> > > > >> Android framework engineer
> > > > >> romain...@android.com
>
> > > > >> Note: please don't send private questions to me, as I don't have time
> > > > >> to provide private support.  All such questions should be posted on
> > > > >> public forums, where I and others can see and answer them
>
> > > > --
> > > > Romain Guy
> > > > Android framework engineer
> > > > romain...@android.com
>
> > > > Note: please don't send private questions to me, as I don't have time
> > > > to provide private support.  All such questions should be posted on
> > > > public forums, where I and others can see and answer them- Hide quoted 
> > > > text -
>
> > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to