Search code examples
androidembedded-resource

Android: How to embed a class inside a textview of another xml?


This is my layout:

<ListView>
   <TextView></TextView>
</ListView

This xml is the main.xml with main.java. How can i embed intro.xml with intro.java into the <Textview>?

thanks for your help.


Solution

  • You do not put TextView widgets inside of a ListView in a layout XML file. Also, you do not embed other widgets inside of a TextView.

    To put things in a ListView, you need to use a ListAdapter, such as ArrayAdapter or CursorAdapter, depending on where your data is coming from.

    You may wish to review the ListView tutorial.