I currently have an xml layout called quests.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10dip">
<Button
android:id="@+id/btn_load_quests"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="15dip"
android:layout_marginLeft="110dip"
android:text="Load Quests" />
<TextView
android:id="@+id/quest_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="8pt"
android:textColor="#FFFFFF"
android:layout_alignParentLeft="true"
android:text="buy 2 cups of coffee"/>
<TextView
android:id="@+id/quest_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10pt"
android:textColor="#00C322"
android:layout_below="@id/quest_title"
android:text="$25" />
<TextView
android:id="@+id/quest_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10pt"
android:textColor="#1D81C1"
android:layout_below="@id/quest_price"
android:layout_alignParentLeft="true"
android:text="25 pts" />
<Button
android:id="@+id/btn_select_quest"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/quest_points"
android:text="1" />
</RelativeLayout>
I wanted to know how I can use the id in multiple cases (multiple quest_titles, etc) like a list. Im loading the data from mysql and I wanted to know how to handle multiple rows. Basically something like the equivalent of classes in css.
If you load data from mysql you’ll need some adapter. You don’t need multiple ids, because you inflate multiple views, each representing a single row of your list. Example: http://sudarmuthu.com/blog/using-arrayadapter-and-listview-in-android-applications
If you’re looking for css equivalent, then you should read about styles and themes. With them it’s easy to make many elements look the same.
When it comes to multiple ids – you can’t use multiple ids within one layout.