Hi all!
I would like to dynamically build a view that would display a certain
number of 'rows'.
Here is a piece of code I wrote, but it is not working:
----- CODE -------------------------------------------
LinearLayout layout = new LinearLayout(context);
status_response response = rem.get_activity ();
if( !response.activity.isEmpty () )
{
for( activity act : response.activity )
{
act.getThumb ();
RelativeLayout element = (RelativeLayout) findViewById
( R.id.activity_element );
ImageView act_image = (ImageView)findViewById
( R.id.activity_image );
TextView act_descr = (TextView)findViewById
( R.id.activity_description );
act_image.setImageDrawable ( act.thumb );
act_descr.setText ( act.activity_presence );
layout.addView ( element );
}
}
----- CODE -------------------------------------------
and the activity_element.xml file:
----- CODE -------------------------------------------
<RelativeLayout
android:id="@+id/activity_element"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ImageView
android:id="@+id/activity_image"
android:layout_width="32px"
android:layout_height="32px"
android:layout_alignParentLeft="true"
>
</ImageView>
<TextView
android:id="@+id/activity_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_alignTop="@+id/image"
android:layout_toRightOf="@+id/image"
>
</TextView>
</RelativeLayout>
----- CODE -------------------------------------------
So, obviously, I would like to add N new activity_element elements to
my Linear layout and assign some parameters before doing this.
I would appreciate some advice on how to make this work.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---