See here:

http://developer.android.com/reference/android/widget/ImageView.html

In particular, a table listing XML attributes and their equivalent Java methods has this line:

android:src setImageResource(int) Sets a drawable as the content of this ImageView.

So the solution is:

image.setImageResource(R.drawable.newimage);

You should also read through this:

http://developer.android.com/guide/topics/resources/accessing-resources.html

-- Kostya

07.08.2010 12:46, [email protected] пишет:
textview has this:
TextView title = (TextView)findViewById(R.id.title);
         title.setText("new text");

how can i change the src of an image?

i want to do something like this:
ImageView image = (ImageView)findViewById(R.id.image);
         image.setsrc("drawable/newimage");

but ImageView doesnt have a setsrc property.

thank you for your help.



--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to