I saw it used in textview and webview
android:id="@+id/textview"
android:id="@+id/webview"
but looks like there is none for DigitalClock widget.
So, when do I have to use it? Just for text and web views?
I saw it used in textview and webview
android:id="@+id/textview"
android:id="@+id/webview"
but looks like there is none for DigitalClock widget.
So, when do I have to use it? Just for text and web views?
No. That kind of identifiers are customizable by the programmer. It's used to reference the Views from the Java code. For instance:
TextView foo = (TextView) findViewById(R.id.textview);
Of course, you can use any name you want. For example:
android:id="@+id/whatever_you_want"
Will be referenced this way:
TextView foo = (TextView) findViewById(R.id.whatever_you_want);
Another thing to bear in mind is that there are some IDs that are reserved. Any way, you will recognize user-created IDs because they contain a plus (+): @+id/whatever
You use it when you need it, either to:
R.id.whatever
)RelativeLayout
)