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

Apps Why doesn't this make a list?

thyrgle

Lurker
Dec 27, 2010
4
0
Code:
public class AnApp extends ListActivity {
    /** Called when the activity is first created. */
    static final String[] MAIN_MENU = new String[] {
        "One", "Two", "Three"
    };
    @Override
    public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          
          setListAdapter(new ArrayAdapter<String>(this,
                  android.R.layout.simple_list_item_1, MAIN_MENU));
          getListView().setTextFilterEnabled(true);
    }
}
I adapting this tutorial to make a list: Hello, ListView | Android Developers

All I have done in my project is changed the AnApp class so it extends ListActivity (instead of Activity). Copy and pasted the onCreate method in the tutorial. Made a String called MAIN_MENU and replaced the COUNTRIES variable in the tutorial with MAIN_MENU.

My code is running with no errors or warnings, but no list appears, what could I be doing wrong?
 

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