What's the error message? obtainStyledAttributes() is defined in android.content.Context
You might consider cleaning the project and rebuild. -- Jack Ha Open Source Development Center ・T・ ・ ・Mobile・ stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 16, 2:21 pm, Neilz <neilhorn...@googlemail.com> wrote: > Hi Jack, thanks for your response. > > It still doesn't compile... what is the method obtainStyledAttributes > ()? This doesn't resolve. > > On Jul 16, 4:15 pm, Jack Ha <jack...@t-mobile.com> wrote: > > > Create a file called attrs.xml and place the following in it: > > > <?xml version="1.0" encoding="utf-8"?> > > <resources> > > <declare-styleable name="default_gallery"> > > <attr name="android:galleryItemBackground" /> > > </declare-styleable> > > </resources> > > > Then replace the code in ImageAdapter with the following: > > > TypedArray a = obtainStyledAttributes > > (R.styleable.default_gallery); > > mGalleryItemBackground = a.getResourceId( > > R.styleable.default_gallery_android_galleryItemBackground, 0); > > > -- > > Jack Ha > > Open Source Development Center > > ・T・ ・ ・Mobile・ stick together > > > The views, opinions and statements in this email are those of > > the author solely in their individual capacity, and do not > > necessarily represent those of T-Mobile USA, Inc. > > > On Jul 16, 6:30 am, Neilz <neilhorn...@googlemail.com> wrote: > > > > Hi all. I tried thisexample(http://developer.android.com/guide/ > > > tutorials/views/hello-gallery.html) and found the compilation problems > > > which having done some searching I see that many other people have > > > found the same thing. > > > > No one seems to have found a solution to this. It would be great if > > > someone involved could update thisexample, or provide clear > > > instructions on how to get it working - as it would be a nice feature > > > to try out. The problem stems from the 'styleable' attribute of the > > > following line: > > > > public ImageAdapter(Context c) { > > > mContext = c; > > > TypedArray a = obtainStyledAttributes > > > (android.R.styleable.Theme); > > > mGalleryItemBackground = a.getResourceId( > > > android.R.styleable.Theme_galleryItemBackground, 0); > > > a.recycle(); > > > } > > > > Thanks. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---