Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is ids.xml used for?

Tags:

android

Just a quick question, what is the ids.xml used for when developing an Android app? I saw an example on the android resources webpage which contained:

<resources>   <item name="snack" type="id"/> </resources> 

What would this be used for?

like image 404
sam Avatar asked Oct 01 '11 16:10

sam


People also ask

What is IDS XML?

id. xml is generally used to declare the id's that you use for the views in the layouts. you could use something like <TextView android:id="@id/snack"> for your given xml.

What is ids in Android?

The Android unique device ID is called the Android Advertising ID (AAID). It's an anonymized string of numbers and letters generated for the device upon initial setup.


2 Answers

id.xml is generally used to declare the id's that you use for the views in the layouts.

you could use something like

<TextView android:id="@id/snack"> 

for your given xml.

like image 190
Yashwanth Kumar Avatar answered Oct 14 '22 21:10

Yashwanth Kumar


ids.xml has the following advantage: all ids were declared, so compiler can recognize them. If something like this:

<TextView     android:id="@+id/text1"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:layout_alignBelow="@id/text2"     android:text="...."/> <TextView     android:id="@+id/text2"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:text="...."/> 

Can result in compiling error because text2 was refered before declared

like image 21
Ngo Phuong Le Avatar answered Oct 14 '22 23:10

Ngo Phuong Le