How to display Name in your Layout dynamically?



I am working on an Android App, which needs to have a friend list. I am communicating to Server, Server returns me a "Name", how do I display this Name in my Layout.


My xml code:



<LinearLayout
android:gravity="top"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="My Friend List" />
</LinearLayout>

<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="top"
android:orientation="horizontal" >

<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/add_more_friends" />

</LinearLayout>

</LinearLayout>

No comments:

Post a Comment