Problem with that is that my image name is only determined at runtime,
not compile time.

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Ahmed Abdel
samea
Sent: Wednesday, April 30, 2008 1:55 PM
To: [email protected]
Subject: [android-beginners] Re: ImageView/ImageButton question


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.
<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i6
2sR8HDtDypao8Wcj9tAcJ> 
        
        
                
        
        


--~--~---------~--~----~------------~-------~--~----~
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-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to