tags:

views:

60

answers:

2

Hi,

I'm obviously pretty new to Android. Does better documentation exist for the set of android.R.* classes somewhere? The API reference is pretty bare bones, many times only containing the resource literal IDs and not explaining how/where they are used. Similarly, it would be nice if additional information (or pictorial examples) existed for the various platform defined layouts and styles.

Or am approaching this the wrong way? Perhaps there's a better method to determine their usage than going straight to the documentation. I'm finding this portion (I'm not even sure what to call it) to be the most confusing aspect of Android programming by far and am open to any suggestions that will better my understanding.

Thanks!

A: 

Source code would be the best documentation. At least, it's very helpful when you need to understand how the function does what is briefly described in documentation.

Eugene Mayevski 'EldoS Corp
Hmm, that's the best I've been able to find myself. I was hoping there was something that would hold my hand a little bit more during these first steps. Also is there any sort of guide to the structure of the source code? It's not always obvious which XML file(s) the various resources come from.
commie64
For me developers guide (http://developer.android.com/guide/topics/resources/accessing-resources.html and other resources there) was sufficient to understand the basics, after that I had to revert to source code.
Eugene Mayevski 'EldoS Corp
Thanks, Eugene. I think this is probably the only answer for my question. I'm a bit disappointed, but it is what it is. Maybe I'm being picky, but I'd really like to see documentation for each platform resource that at least includes a brief statement of its intended use. For example, for "android.R.layout.simple_list_item_1" it would be nice if it said something like "Intended to be used as layout for list items in a ListAdapter" and perhaps a nice link to the source XML so we don't have to go hunting for it.
commie64
A: 

I think you are confused about what R is.. The R file is autogenerated during the compilation process based on the resources you have in your res folders.

So, if you add a strings file: res/values/strings.xml with contents:

<resources>
    <string name="string_name">text_string</string>
</resources>

R will now contain an entry for R.string.string_name.

For a details on all of the different types of resources, see resource types.

Edit: As to "platform defined layouts", have you looked at the developer docs on it? See common layout objects. Also each layout type has a tutorial on it, search for "Hello --layout type--"

Mayra
If you've defined it, it's accessible under R.*, but there are a set of things Android provides under android.R.*, which is what the OP is asking about. (e.g. android.R.layout.simple_list_item_1)
Rob Lourens
Yes, Rob is correct. Thanks though, Mayra.
commie64
Oh, ok.. I've seldom had a reason to use those. I think just looking at the source is your best bet.
Mayra