What do you mean by "not in a new one" . Go thru this sample. Hope it helps.

http://techdroid.kbeanie.com/2010/09/expandablelistview-on-android.html




On Tue, Nov 2, 2010 at 4:29 PM, titleist <tadej.ore...@gmail.com> wrote:

> Hello,
> I'm trying to create a ExpandableListView in one activity. I've looked
> in apis demos, and I've created ExpandableListView. The problem is,
> that I need to have this  ExpandableListView in activity that is
> already created, and not in a new one. I've used this code:
>
>
> /*
>  * Copyright (C) 2007 The Android Open Source Project
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
>
>
>
> /**
>  * Demonstrates expandable lists backed by a Simple Map-based adapter
>  */
> public class ExpandableList3 extends ExpandableListActivity {
>    private static final String NAME = "NAME";
>    private static final String IS_EVEN = "IS_EVEN";
>
>    public ExpandableListAdapter mAdapter;
>
>    @Override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        List<Map<String, String>> groupData = new
> ArrayList<Map<String, String>>();
>        List<List<Map<String, String>>> childData = new
> ArrayList<List<Map<String, String>>>();
>        for (int i = 0; i < 20; i++) {
>            Map<String, String> curGroupMap = new HashMap<String,
> String>();
>            groupData.add(curGroupMap);
>            curGroupMap.put(NAME, "Group " + i);
>            curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is
> even" : "This group is odd");
>
>            List<Map<String, String>> children = new
> ArrayList<Map<String, String>>();
>            for (int j = 0; j < 15; j++) {
>                Map<String, String> curChildMap = new HashMap<String,
> String>();
>                children.add(curChildMap);
>                curChildMap.put(NAME, "Child " + j);
>                curChildMap.put(IS_EVEN, (j % 2 == 0) ? "This child is
> even" : "This child is odd");
>            }
>            childData.add(children);
>        }
>
>        // Set up our adapter
>        mAdapter = new SimpleExpandableListAdapter(
>                this,
>                groupData,
>                android.R.layout.simple_expandable_list_item_1,
>                new String[] { NAME, IS_EVEN },
>                new int[] { android.R.id.text1, android.R.id.text2 },
>                childData,
>                android.R.layout.simple_expandable_list_item_2,
>                new String[] { NAME, IS_EVEN },
>                new int[] { android.R.id.text1, android.R.id.text2 }
>                );
>        setListAdapter(mAdapter);
>    }
>
> }
>
>
>
>
> In my current activity I have one spinner(on top) and two buttons(on
> bottom). My ExpendableListView would have to be below spinner, but I
> don't know how to set up padding for ExpandableListView, or how can i
> use this class(ExpandableList3) in my current activity (some other
> class). This class(ExpandableList3) only works if i open it as new
> activity :/
>
>
>
>
> Regards,
> Tadej
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

-- 
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