Thanks !

So yes I got it to work by calling setAdapter on the ListView object.

       //setListAdapter for ListView 1
       setListAdapter(new ArrayAdapter<String>(this, R.layout.row,
R.id.label, mStrings));
       //Code to display ListView 2
       ListView  cities = (ListView) findViewById(R.id.ListView01);
       ArrayAdapter aa = new ArrayAdapter<String>(this, R.layout.row,
R.id.label, mStrings2);
       cities.setAdapter(aa);

So that works and displays the two ListViews.

Any pointers in how I can now change the behaviour of how Android
deals with interaction between the two lists ?
For Example if I have two ListViews one ontop of another, for me to
scroll the list in the bottom ListView I have to navigate all the way
down through all items in ListView 1 before entering or focussin on
List View2.

How can I program ListView2 to get focus if it is selected via touch ?

I am looking for a function is ListActivity for this but dont find
anything.

Any tips ?


Thanks


On Mar 25, 1:50 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> xinit wrote:
> > Hello
>
> > I am trying to design a UI which utlizes two ListViews on the screen
> > at the same time.
> > Is this possible ?
>
> > So here is a quick example of how I was intending to do this.
>
> > 1) Create an XML which positions 2 ListViews one onto of the other
> > eachListViewhaving there own ID
>
> > <ListView
> > android:id="@android:id/list"
> > android:layout_width="fill_parent"
> > android:layout_height="198px"
> > </ListView>
>
> > <ListView
> > android:id="@+id/ListView01"
> > android:layout_width="192px"
> > android:layout_height="215px"
> > </ListView>
>
> > 2)  Create two string arrays and populate eachlistviewvia
> > ArrayAdapter
>
> > private String[] mStrings = {
> >             "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam",
> > "Abondance", "Ackawi",
> >             "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l
> > Pitu", "Airag", "Airedale",
> >             "Aisy Cendre"};
>
> >     private String[] mStrings2 = {"dsds", "qwqwqq", " dsdsdsd sdsdsds
> > ", "dsdsds sdsds"};
>
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         setContentView(R.layout.main);
>
> >         setListAdapter(new ArrayAdapter<String>(this, R.layout.row,
> > R.id.label, mStrings));
> >         setListAdapter(new ArrayAdapter<String>(this, R.layout.frow,
> > R.id.ListView01, mStrings2));
> >     }
>
> > This does not work.
> > Can anyone advise ?
>
> You cannot use the ListActivity methods for managing the secondListView. You 
> will need to use findViewById() and handle thatListView
> manually.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Android App Developer Training:http://commonsware.com/training.html- Hide 
> quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to