• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

ListView problem

captsisko

Lurker
Jul 21, 2010
2
0
Hi all,

I am following a tutorial from a book on ListViews but while my activity launches just fine, my menu ListView does not display.

Can anyone help a newbie and tell me what maybe wrong with the following code?

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!");

String[] items = new String[] {"test#1","test#2","test3","test#4"} ;
ListView menuList = (ListView)findViewById(R.id.ListView_Menu);
// By using setAdpater method in listview we an add string array in list.
menuList.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , items));


Log.i(LOGID, "Reaching this point!");
}

/*private String[] items = new String[] {"test#1","test#2","test3","test#4"} ;*/
}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones