Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to include list along side other UI elements? (Android)
    primarykey
    data
    text
    <p>I'm new to android developing, so i apologise if this is a simple/noob-ish question, and for any incorrect terminology.</p> <p>but what i need to know is how can i include a list alongside of other UI elements (such as TextView, ImageView elements etc)</p> <p>upto now, all i have been able to achieve is a list activity all on its own, which to do this i have been using the ListActivity class type.</p> <p>My list activity:</p> <pre><code>import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; public class ListViewExample extends ListActivity { String[] exampleList = { "Item 1", "Item 2", "Item 3" //etc etc }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listview); setListAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, exampleList)); } } </code></pre> <p>Which is started within my Main class/activity:</p> <pre><code>import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class NewtestActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); startActivity(new Intent( this, ListViewExample.class)); } } </code></pre> <p>but with the function of "startActivity()", this seems to just switch to that activity, and not "include" it to the current, which of-corse means that any elements within "R.layout.main" (defined above the calling of "startActivity()) are not shown.</p> <p>Is there anyway to include this activity within my main activity? or is there a better way of making a list?</p> <p>(my goal will eventually be to make the list array dynamic, just thought id say in case that affected on any suggested solution).</p> <p>thanks for any help (:</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload