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?

-- 
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