Hello,

Could someone explain to me why the entry of a ListView id (list)
defined in the layout files used by my application is not among the
entries in the "id class" in R.java?

(In spite of this) The application works as expected.

However, if I try to generate a layout file and associate a ListView
to it (see code below) at the start of the activity without using a
pre-built layout file, and then "setContentView", the application
crashes, reporting among others:

"Your content must have a ListView whose id attribute is
"android.R.id.list""

In the code below, if I remove the "setContentView(main)" line, the
application does not crash (understandably).

DDMS error output also includes an "unable to start activity
ComponentInfo..." error message.

Any help in resolving this issue would be appreciated.

Thanks.

Alex Donnini

P.S. I tried to regenerate R.java. It made no difference.


    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        LinearLayout main;
        ListView lv;

        main = new LinearLayout(this);
        main.setLayoutParams(new LinearLayout.LayoutParams(320,480));
        main.setBackgroundColor(Color.WHITE);

        lv = new ListView(this);
        lv.setLayoutParams(new LinearLayout.LayoutParams(320,100));
        lv.setBackgroundColor(Color.BLUE);

        main.addView(lv);

        setContentView(main);
    }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to