Where and how are you setting attribute values?

Your call to getStylableAttributes is looking for attribute values in the activity's theme, is that where you've specified your values?

-- Kostya

10.01.2011 12:35, Adam Goodchild пишет:
Hey,

Ive been looking into getting Custom Attributes working within an
application. I have this working up to the point where I am able to
assign the custom attribute via XML to one of my Views (a Background
or Image Source for example).

What I now want to do is access the Custom Attributes via Code, within
my Activity. I am not implementing custom Views here. I am just
wanting to access, within my Activity, the custom attributes that I
have defined. I will use these to programatically change the look of
my List View based on certain criteria.

Is there a way I can do this? I have the following code, but it does
not work, returns null each time. The code is just a test to assign a
background of the splash programatically.

     @Override
     public void onCreate(Bundle icicle) {
          super.onCreate(

          setContentView(R.layout.splash);

          TypedArray a =
getApplicationContext().obtainStyledAttributes(R.styleable.MainSplash);
          int i =
a.getResourceId(R.styleable.MainSplash_splashDrawable, 0);
      }

I always get returned '0' when using the above code. Any ideas?



--
Kostya Vasilyev -- 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to