In following a tutorial from "SAMS Android Application Development in 24 hours" I hit a problem with my first ListView example.
Basically, my java code is firing according to log messages I set but my ListView does not display when I execute my app. The App runs fine without crashing so syntactically all seems to be well. Since I can't attach documents, please bear with me as I paste some code but you can download the entire sample app from http://www.icerge.com/android-sample-app-download My layout file is called Menu.xml and is as below: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/quizicon"> </ImageView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentTop="true" android:textColor="@color/menuxmlTitleColor" android:textSize="@dimen/menuxmlTitleSize" android:id="@+id/menuxmlTitle" android:text="@string/menuxmlTitleText"> </TextView> <ImageView android:id="@+id/ImageView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:src="@drawable/quizicon"> </ImageView> </RelativeLayout> <RelativeLayout android:id="@+id/RelativeLayout02" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ListView android:layout_height="wrap_content" android:layout_above="@+id/ImageView03" android:layout_width="fill_parent" android:layout_alignParentTop="true" android:id="@+id/ListView_Menu" android:layout_centerVertical="false"> </ListView> <ImageView android:id="@+id/ImageView03" android:layout_alignParentBottom="true" android:scaleType="fitEnd" android:layout_width="fill_parent" android:layout_height="fill_parent"> </ImageView> </RelativeLayout> </LinearLayout> The java file is called QuizMenuActivity.java and is as follows: package com.androidbook.triviaquiz; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.ListView; public class QuizMenuActivity extends QuizActivity { private final String LOGID = "Track"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.menu); Log.i(LOGID, "Begining!"); ListView menuList = (ListView) findViewById(R.id.ListView_Menu); /*String[] items = { getResources().getString(R.string.menu_item_play), getResources().getString(R.string.menu_item_scores), getResources().getString(R.string.menu_item_settings), getResources().getString(R.string.menu_item_help) };*/ String[] items = {"test#1","test#2","test3","test#4"} ; ArrayAdapter<String> adapt = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items); menuList.setAdapter(adapt); Log.i(LOGID, "Reaching this point!"); } } Finally, there is a Menu_item.xml which defines my TextView that the java file above attempts to write array data to. It is as follows: <TextView android:id="@+id/TextView01" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:text="testing testing" android:layout_gravity="center_horizontal" android:shadowRadius="5" android:gravity="center" android:textColor="@color/listview_items_color" android:shadowDx="3" android:shadowDy="3" android:textSize="@dimen/menuxml_item_size" android:shadowColor="@color/listview_items_color_glow"> </TextView> As I don't want to overwhelm you with code you will have to take my word for it that all the resources are in place and are not the problem. Can anyone offer some insight? Please download the app from http://www.icerge.com/android-sample-app-download to examine the code better and see what I mean. Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en