Re: [android-developers] assign drawable to variable not imageview
On Sat, Apr 2, 2011 at 3:14 PM, Raghav Sood <raghavsood@gmail.com> wrote:
> I need to use this function:
>
> public Drawable getDrawable ().
>
> How do I assign this to a variable and which type of variable do I need.
Presumably, you need a Drawable variable. You assign it the same way
you assign anything else in Java. Please consider asking Java syntax
questions on StackOverflow, tagged with the 'java' tag.
> Also is there a better way of finding out an imageview's current image
> resource?
Track it yourself, since you are the one assigning the resources to
the ImageView. An ImageView may not have a "current image resource",
since it may not have been populated with a resource in the first
place (e.g., loaded with a bitmap from a downloaded PNG file). If you
are trying to use getDrawable() to tell what your "current image
resource" is, that will not work.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
_The Busy Coder's Guide to *Advanced* Android Development_ Version
1.9.2 Available!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home