1. AC Question's Avatar
    What is up with Android Studio.? I have tried for 18 days to populate a simple listView and it never work's.! It work's in XML but not MainActivity.

    I am copying and pasting code from Android's own web page's showing you how to use ArrayAdapter<String> to populate the listView widget, and I always get "errors".

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
    android.R.layout.simple_list_item_1, myStringArray);

    ListView listView = (ListView) findViewById(R.id.listView);

    .setAdapter(adapter); alway's show's error's all the way across. Here is the Array I constructed using Oracle's own tutorial.

    String [] myStringArray = {

    one, two, three, four, five, six, seven, eight, nine, ten

    I have been to Github, Stack Overflow, GrepCode, and Oracle's Java tutorial's and nothing work's.? I also found it very short sighted that you can not use some form of android:onClick in listViews XML to set up Intent's in MainActivity like you do with button's. Instead, you have to construct all this onItemClick code when they should have just made listView out of button's and not TextView's.
    07-29-2015 12:18 PM

Similar Threads

  1. Replies: 2
    Last Post: 08-02-2015, 03:03 AM
  2. Replies: 5
    Last Post: 07-30-2015, 01:06 PM
  3. Replies: 1
    Last Post: 07-29-2015, 12:24 PM
  4. Replies: 1
    Last Post: 07-29-2015, 11:37 AM
  5. My Mikona tablet stopped working, how can I get it working again?
    By Rayne Ulfa in forum General Help and How To
    Replies: 0
    Last Post: 07-29-2015, 11:15 AM