Bitmap of selected list item

Problems with Canvas, OpenGL, etc...

Bitmap of selected list item

Postby andywhoa » Fri Jan 07, 2011 10:14 pm

I'd like to make list items animate, falling to the bottom of the screen and shrinking, as they're clicked on.

I believe doing this requires the following:
- When a list item is clicked, a bitmap of the list item is created.
- The bitmap is animated so it falls to the bottom of the screen and shrinks.

At the moment, I'm still stuck on the first step. How exactly would I create a bitmap of the list item? Here is my attempt so far:

Code: Select all
    protected void onListItemClick(ListView l, View v, int position, long id) {
       super.onListItemClick(l, v, position, id);
       Bitmap bit = v.getDrawingCache();
   // do something with bit

This does not work (when debugging, I see that the width and height of bit are -1). What am I doing wrong?

If you would like to give me some insight into the second step, that would be much appreciated, too.

Thank you for your time
Experienced Developer
Experienced Developer
Posts: 82
Joined: Tue Jul 20, 2010 12:46 am
Location: Across the pond


Re: Bitmap of selected list item

Postby jonbonazza » Sun Jan 09, 2011 5:42 am

The easist thing to do is to subclass AdapterView.

Take a look at this:
This is part 1 of a 3 part series, and you really should read them all to get an answer for your question. ... st-part-1/
Master Developer
Master Developer
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 3 guests