How to get handle to ImageView in a ListItem

by Hari » Fri, 30 Jul 2010 08:30:15 GMT


Sponsored Links
 Hi,
I have implemented a "EfficientAdapter". Each list item is a
LinearLayout of a combination of image and text views.  This
EfficientAdapter is attached to a Array<CustomObject>. Code snippet is
below:

[code]
public class ExampleList extends ListActivity {
  private class EfficientAdapter extends BaseAdapter {
    .........
      public View getView(int position, View convertView, ViewGroup
parent) {
           ..........
           //Make the ICON Clickable
          holder.icon.setOnClickListener(mCorkyListener);
      }

      class ViewHolder {
            ......
            TextView dateRange;
            ImageView icon;
            .....
        }
  }

  public void onCreate(Bundle savedInstanceState) {.....}

  protected void onListItemClick(ListView l, View v, int position,
long id) {.....}

  public OnClickListener mCorkyListener = new OnClickListener() {
        public void onClick(View v) {
                // do something when the button is clicked
                Log.i("Item ID", v.getId()+"");
                captureImage();
    }};

   .................
 }
[/code]

The captureImage() method brings up the option for user to select an
image from Gallery or click a snap.

My Problem:
"I DO NOT KNOW" how to get a handle to the image in the list item that
was clicked. I will have refresh the image view with what ever image
was selected by the user.

Any leads or pointers in resolving this issue is greatly appreciated

Thanks
Hari

--



How to get handle to ImageView in a ListItem

by Mark Murphy » Fri, 30 Jul 2010 08:32:23 GMT


 The View passed into onListItemClick() is the row. Call findViewById()
on that View to retrieve your ImageView.



>


Sponsored Links


How to get handle to ImageView in a ListItem

by Hari » Sat, 31 Jul 2010 06:45:56 GMT


 Hi Mark,
Thanks for the Reply.

I might have not stated my question properly.

I have implemented another functionality for onListItemClick().

Each list item has a ImageView and i want the user to be able to
change this image by selecting from phone's gallery or by taking a
snap. So i have an onClicklistener() for the image view. How can i
know which ListItem was clicked? I also would like to update the
database for this ListItem to save the image byte[] in blob column.
For this reason i have to know the item that was clicked.

Regards
Hari




> >



How to get handle to ImageView in a ListItem

by greg » Sat, 31 Jul 2010 07:26:32 GMT


 I also use the EfficientAdapter BaseAdapter in my ListView.  Is it not
possible for you to use the onItemClick handler, which provides the
list index (i.e., position), to implement your image change?  (That's
what I do.)






> > >



How to get handle to ImageView in a ListItem

by Hari » Sat, 31 Jul 2010 08:09:22 GMT


 i Greg,
I gave a thought to that approach as well. I want the image selection
dialog to come up only when the user clicks on the image view.

With onItemClick handler, the dialog pops up when user clicks any
section of the list item. How do i make sure that the dialog pops up
only when the user clickes on the Image.

Regards
Hari

On Jul 30, 7:26pm, greg <sep...@eduneer.com> wrote:
> > > >



How to get handle to ImageView in a ListItem

by greg » Sat, 31 Jul 2010 20:56:34 GMT


  haven't tried it, but perhaps another listener to detect the x
coordinate of the click? (The more complicated y coordinate could be
ignored if the image fills the row height.)


On Jul 30, 8:09pm, Hari <mba.for.d...@gmail.com> wrote:
> > > > >



Other Threads

1. How to make a Draggable Menu

Hi

Im wondering how to make a nice snappy menu like the menu on "Home"..
the one with an arrow which you can drag into the screen, presenting
all available applications.
Do I have to implement my own custom widget, or is there a widget for
it already.

Something like having this line on the bottom of your application at
all times

            /-------------\
-----------/   Menu    \---------------





....which you can drag with you finger to reveal a panel with lots of
menu icons, even form elements lika a searchfield...



            /-------------\
-----------/   Menu    \---------------
|                                         |
|    Item1                 Item2    |
|                                         |
|                                         |
|    Item3                 Item4    |
|                                         |
|   -----------------------  ---------    |
|   | TextEdit...      | | OK  |    |
|   -----------------------  ---------    |



Anyone know any example or code that could help me out here?

Thanks alot.




--~--~---------~--~----~------------~-------~--~----~

2. What is the problem with my android: Unable to extract+optimize DEX from '/system/framework/ext.jar'

Hello, guys.

   Though extracting failed, the system can bootup to Android desktop
(sometimes it fails). I really want to know what happened there.
I have compared the target file /system/framework/core.jar' with the
orignal file located in HOST PC, they are exactly the same.

 And here is the log:
/*****************************************************************************************************/
...
E/dalvikvm( 1040): ERROR: bad checksum (c366a6a6, expected fe6ea6aa)
E/dalvikvm( 1040): ERROR: Byte swap + verify failed
E/dalvikvm( 1040): Optimization failed
W/dalvikvm(  997): DexOpt: --- END 'core.jar' --- status=0xff00, process failed
E/dalvikvm(  997): Unable to extract+optimize DEX from
'/system/framework/core.jar'
W/dalvikvm(  997): JNI_CreateJavaVM failed
E/AndroidRuntime(  997): JNI_CreateJavaVM failed
E/dalvikvm( 1045): ERROR: bad checksum (07818e96, expected 4c4d8f58)
E/dalvikvm( 1045): ERROR: Byte swap + verify failed
E/dalvikvm( 1045): Optimization failed
W/dalvikvm( 1041): DexOpt: --- END 'ext.jar' --- status=0xff00, process failed
E/dalvikvm( 1041): Unable to extract+optimize DEX from
'/system/framework/ext.jar'
W/dalvikvm( 1041): JNI_CreateJavaVM failed
E/AndroidRuntime( 1041): JNI_CreateJavaVM failed
I/Zygote  ( 1046): Preloading classes...
I/Zygote  ( 1046): ...preloaded 1166 classes in 2708ms.
I/Zygote  ( 1046): Preloading resources...
I/Zygote  ( 1046): ...preloaded 48 resources in 351ms.
I/Zygote  ( 1046): ...preloaded 15 resources in 6ms.
I/Zygote  ( 1046): Accepting command socket connections
E/SurfaceFlinger( 1051): Couldn't open /sys/power/wait_for_fb_sleep or
/sys/power/wait_for_fb_wake
/********************************************************************************************************************/

Looking forward to your reply!
Thanks.


                             Yang.

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Failed to launch the android under the emu

4. getDeviceId returns null

5. Do i need to release the static variable and remove the listener when the app is closed?

6. Do i need to release the static variable and remove the listener when the app is closed?

7. BouncyCastle code in dalvik/libcore