Getting item on a ExpandableListView

by Alessandro Pellizzari » Sun, 14 Feb 2010 01:44:52 GMT

Sponsored Links
 Hi all,

it seems nobody ever documented ExpandableListViews, and I am going
crazy... I tried for at least 3 hours, now. :/

I have overriden onChildClick, and it gives me groupPosition and
childPosition, but it seems there is no getItemAtPosition(groupPosition,
childPosition) and no other way to get the correct item.

How do I get the item?

Thank you very much


Getting item on a ExpandableListView

by TreKing » Sun, 14 Feb 2010 02:35:35 GMT


Yes, they did: 

How do I get the item?

If you read the documentation, you may find this function: #getExpandableListAdapter%28%29

which will get you adapter that has the data in the ExpandableListView. That
in turn has a getChild(group, child) function: #getChild%28int,%20int%29

TreKing - Chicago transit tracking app for Android-powered devices 


Sponsored Links

Getting item on a ExpandableListView

by Alessandro Pellizzari » Mon, 15 Feb 2010 21:36:04 GMT

 Il giorno sab, 13/02/2010 alle 12.34 -0600, TreKing ha scritto:

I meant: no examples, no directions, no blog posts, no manuals. I only
found a german book on google books, but I could only see 2 pages of it
and didn't get to the point. :/

All the ListView examples use ListView.getItemAtPosition(), but nowhere
I found documented that this is a "wrapper" around the adapter
(inherited from the AdapterView, in fact). :/

This led to my confusion, as ExpandableListView has no such "facility".

Thank you very much. Now I understand how the ListViews "think". :)


Alessandro Pellizzari


Other Threads

1. Customize the lock screen or customizing its functionalites?


I will like to develop an App which modifies LockScreen of Android. I
have read in some forums that it is not supported as yet in the SDK
but there are some applications available that does exactly that.

One can surf "
advanced-lock_gfrr.html?nav=related&p=10". There are many more
application which implement the same thing. So, how does they do that.

Can someone let me know is it actually possible to customize
LockScreen and implement our own way of Lock Screen?

Can I start my application after BOOT_COMPLETED broadcast receiver and
display my lock screen app? But in this case how to bypass the native
lock screen application.

Hope to get a quick reply.

Thanks & Regards


2. Socket freezes using GSM connection


I working on application that uses a socket connection.
Ie implemented 2 different Threads for the read() and the write()
methods so they are not being blocked by the read.
Everything is working well on the WiFi connection but when I switch to
GSM connection the connection becomes unstable without any exception
being thrown. It means that there are freezes the write and read
seems to work but no data is actually being piped.
Here is what I doing:

private Socket socketConn = null;
private DataInputStream dis = null;
private DataOutputStream dos = null;

//Read buffer
private byte[] buffer;
ByteArrayOutputStream readBuffer;

private String serverAddress;
private int serverPort;

public void openConnection(int timeout) throws Exception {
        if(socketConn != null){

        //if we need to resolve the host - if succeed we replace the default
otherwise we use the default.
        //the check is done only once.
                checkHostResolved = false;
                        InetAddress ia = 
                        serverAddress = ia.getHostAddress();
                catch(UnknownHostException e2){
                        MyLog.printException(this, e2, 
        socketConn = new Socket();
        InetSocketAddress isa = new InetSocketAddress(serverAddress,
        socketConn.connect(isa, timeout);
        socketConn.setSoLinger(true, 1000);

        dis = new DataInputStream(socketConn.getInputStream());
        dos = new DataOutputStream(socketConn.getOutputStream());


public void closeConnection() {
        if(socketConn != null){
                        if(dis != null){
                        if(dos != null){
                        if(socketConn != null){
                        if(readBuffer != null){
                catch(IOException ioe){
                        MyLog.printException(this, ioe, "Problem Closing 
                        dis = null;
                        dos = null;
                        socketConn = null;
        MyLog.printLog(this, "closeConnection end");


private int trySend(String message) {

                byte[] data = message.getBytes();
                return 0;
        catch(SocketException se){
                MyLog.printException(this, se, "Problem with trySend");
        catch(Exception e){
                MyLog.printException(this, e, "trySend()");

        MyLog.printLog(this, "trySend() Problem with trySend!!!!");


private boolean tryRead() {
                int b = 0;
                while((b = > 0){
                        readBuffer.write(buffer, 0, b);

                        //if the last read byte is '\0' then we have complete 
reading at
least 1 packet of data
                        if(buffer[b - 1] == '\0'){
                                byte[] data = readBuffer.toByteArray();
                                MyLog.printLog(this, "read data.length=" + 
                                String text = new String(data, "utf-8");
                                return true;
                        MyLog.printLog(this, "out while read b=" + b);
                        //if the b<0 then EOF has reached
                        if(b < 0){
                                throw new Exception("EOF has reached");
        catch(Exception e){
        return false;


Does anyone encounter connection stability problems?
Do I need to open the connection differently?
How about using SocketChannel is it more reliable?
Does Socket connection is a good approach when talking about mobile
network connection?



3. salam kenal dari Dodi

4. Tvout with Android Phones

5. How do I programatically push my app to run in background?

6. Cinta Korea Mod: Mau Tiket Gratis Nonton Wonder Girl (Ambasador Sony Ericsson)

7. how to reduce xml parsing time