KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having a few problems getting my listview to show up in a simple application i'm writing. For some reason the getView() method of my adapter class isn't getting called. However, when when getCount() is called in my adapter class it isn't returning 0 but is in fact returning the proper value. I'm really confused as to why this isn't working. Here is my Activity: import android.app.Activity; import android.os.Bundle; import android.widget.ListView; public class CardListActivity extends Activity { protected ListView lv; protected int nCards = 12; protected String[] cardList = new String[nCards]; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cardlist); this.loadCardStrings(); lv = (ListView) findViewById(R.id.CardList_ListView); EditorListAdapter adapter = new EditorListAdapter(this, this.cardList); lv.setAdapter(adapter); } protected void loadCardStrings(){ cardList = getResources().getStringArray(R.array.card_list); Util.logD("Created the string arrays with:" + Integer.toString(cardList.length) + " items."); } public void onStart(){ super.onStart(); } public void onResume(){ super.onResume(); } public void onPause(){ super.onPause(); } public void onStop(){ super.onStop(); } public void onDestroy(){ super.onDestroy(); } } Here is the layout used by the activity: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/CardList_LinearLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Hello"/> <ListView android:id="@+id/CardList
Tags (comma-separated)
Save Edits
Cancel