Re: [android-developers] ExpandableListView help

2010-11-02 Thread TreKing
On Tue, Nov 2, 2010 at 5:59 AM, titleist  wrote:

> In my current activity I have one spinner(on top) and two buttons(on
> bottom). My ExpendableListView would have to be below spinner,
>

OK.


> but I don't know how to set up padding for ExpandableListView,
>

The same as any other view - via XML or at runtime with the proper functions
/ layout parameters.


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

Well, yeah. Each activity is designed to work standalone (except maybe for
Tabs). You just need to add the ExpandableListView (not the Activity) to you
existing activity. Perhaps changing your existing activity to be an
ExpandableListActivity.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

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

Re: [android-developers] ExpandableListView help

2010-11-02 Thread Kumar Bibek
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  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> groupData = new
> ArrayList>();
>List>> childData = new
> ArrayList>>();
>for (int i = 0; i < 20; i++) {
>Map curGroupMap = new HashMap 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> children = new
> ArrayList>();
>for (int j = 0; j < 15; j++) {
>Map curChildMap = new HashMap 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
> 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

[android-developers] ExpandableListView help

2010-11-02 Thread titleist
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> groupData = new
ArrayList>();
List>> childData = new
ArrayList>>();
for (int i = 0; i < 20; i++) {
Map curGroupMap = new HashMap();
groupData.add(curGroupMap);
curGroupMap.put(NAME, "Group " + i);
curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is
even" : "This group is odd");

List> children = new
ArrayList>();
for (int j = 0; j < 15; j++) {
Map curChildMap = new HashMap();
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
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en