Tuesday, 17 September 2013

MVC in android populating listview from resources

MVC in android populating listview from resources

It seems their should be a way to statically populate a listview with an
array of buttons using only xml using android:resource or android:entries
possibly. I would prefer a resource xml file seperate from my main layout.
If I understand MVC the view is more of a static thing where as the
controller has listeners for the view and makes changes to the view. I
don't know if string array can hold button objects or where I am going
wrong. Any suggestions? Oh and the buttons all should have the same
properties but maybe that is another question?
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/MainFrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
package="com.union.doogie"
android:animateLayoutChanges="true"
android:layoutMode="opticalBounds"
android:visibility="visible"
tools:context=".MainActivity" >
<ListView
android:id="@+id/listViewmain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@buttons/Buttons" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent" >
</TextView>
</ListView>
</FrameLayout>

No comments:

Post a Comment