Hey,

I am also some how beginner in android but what i know to change the pic of the image button dynamically i use the resources not the URi (as i dont know it)

this is my code:

ImageButton ib = (ImageButton) findViewById(R.id.image_button_id);

ib.setImageResource(R.drawable.image_name_in_res); 

 
 
Yours,
     --( H o H i )--

--- On Wed, 4/30/08, Bushnaq, Ahmad <[EMAIL PROTECTED]> wrote:
From: Bushnaq, Ahmad <[EMAIL PROTECTED]>
Subject: [android-beginners] ImageView/ImageButton question
To: [email protected]
Date: Wednesday, April 30, 2008, 8:49 PM

Hi,

I'm having trouble setting the image on either of those
programmatically. If I specify something in the XML it'll work fine, but
I can't seem to find how to specify the image in the code itself.  This
is my code snippet:

ImageButton ib = (ImageButton) findViewById(R.id.image_button_id);
ib.setImageURI(Uri.parse((imageURL)));

Where imageURL is a string. Do I need to then set this to active
somehow? All I keep getting is a blank ImageButton.

Thanks,
Ahmad




      
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-no...
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to