4-level expandable list

16 replies [Last post]
paller's picture
Offline
Joined: 11 Apr 2010
Points: 189
+1
0

A while ago I got a question if 3-level expandable list views can be implemented in Android. Android does not explicitly support it but the flexibility of Android UI widget framework provides a relatively simple implementation option: second-level expandable list views are to be inserted into the first-level expandable list view as child views. There was a blog post with an example program and everybody was happy. Even then I made a note that I don't agree with the approach from the UI point of view because the display becomes unnecessarily messy.

Now there was a comment at that blog post whether 4-level lists are possible. Of course they are possible, it is just not a good UI design. But I guess, you better try it yourself if you don't believe me. The principle is the same (expandable lists embedded as children of higher-level expandable lists), it is just much more complex to make sure that everything is recalculated correctly for every event. In order to follow the operation, I left a good amount of debugging code in the project.

The example program is attached to this post. You have to be logged in to Sfonge website to access it.

 

Attached file: 
Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
have you ever done chat app

have you ever done chat app using XMPP(asmack) in android ...
if u did then you know how to send file in that

paller's picture
Offline
Joined: 11 Apr 2010
Points: 189
asmack

Never tried XMPP at all. There seems to be, however, a class called FileTransferManager in the API that seems easy enough to use ...

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
i used code like this

i used code like this :
ServiceDiscoveryManager sdm = ServiceDiscoveryManager
.getInstanceFor(Main.connection);
if (sdm == null)
sdm = new ServiceDiscoveryManager(Main.connection);
sdm.addFeature("http://jabber.org/protocol/disco#info");
sdm.addFeature("jabber:iq:privacy");
//sdm.addFeature("http://jabber.org/protocol/muc");

XHTMLManager.setServiceEnabled(Main.connection, true);

FileTransferManager manager = new FileTransferManager(Main.connection);
/*OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(id
+ "/Smack");*/
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(id);

Log.i("transfere file", "outgoingfiletransfere is created");
try{
//OutgoingFileTransfer.setResponseTimeout(60000);
transfer.sendFile(new File(txt_file.getText().toString()), "You won't believe this!");

if (transfer.getStatus().equals(Status.cancelled)
|| transfer.getStatus().equals(Status.refused)) {
Log.d("Cancel", ""+transfer.getError());
System.out.println("Cancelled!!! " + transfer.getError());
}

Log.i("transfere file", "sending file");
Log.d("FTTRY", "m in ft TRY");
btn_transfer.setText("Browse");
send_flag = true;
}catch (Exception e) {
Log.d("FTCATCH", "m in ft catch");
send_flag = true;
}

while(!transfer.isDone()) {
try{
Thread.sleep(1000);
}catch (Exception e) {
}
Log.i("transfere file", "sending file status "
+ transfer.getStatus() + "progress: "
+ transfer.getProgress());
if(transfer.getStatus().equals(Status.error)) {
System.out.println("ERROR!!! " + transfer.getError());
} else {
System.out.println(transfer.getStatus());
System.out.println(transfer.getProgress());
Log.d("PROG", "m in ft progress");
}
try{
Thread.sleep(1000);
}catch (Exception e) {
}
}

and i also set provideManager

and m using asmack -jse-buddycloud -2010.12.11.jar

i tried in all the way..but always gives a error like
negotiation file transfer 0:0
filetransfer progress :0

and here is path of image file path from sd card..

please help me ..ASAP

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
if u worked on this ..please

if u worked on this ..please reply me as soon as possible....
because i tried all things but didnt get success.

paller's picture
Offline
Joined: 11 Apr 2010
Points: 189
XMPP

Sadly, I have not experience with XMPP in general and with this library in particular. I am very busy now so I can't help in this.

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
when I try to add data on

when I try to add data on String listdisc and getting below error I add upto PSA101 error not getting but Add PSA103 error Occurs I try to solve this problem but not getting Any Solution
static final String listdesc[][][][][] =
{
{ // MPD [0]
{ // 2D [0],[0]
{ // PSA101
{ "MPD", "" },
{ "2D", "" },
{ "PSA101", "" },
{ "lightgrey","#D3D3D3" },
{ "dimgrey","#696969" }
},
{ // PSA102
{ "MPD", "" },
{ "2D", "" },
{ "PSA102", "" },
{ "lightgrey","#D3D3D3" },
{ "dimgrey","#696969" }
},
{ // PSA103
{ "MPD", "" },
{ "2D", "" },
{ "PSA103", "" },
{ "lightgrey","#D3D3D3" },
{ "dimgrey","#696969" }
}
},
{ // 3D
{ // PSA201
{ "MPD", "" },
{ "3D", "" },
{ "PSA201", "" },
{ "sgi grey 92","#EAEAEA" }
},
{ // PSA201
{ "MPD", "" },
{ "3D", "" },
{ "PSA202", "" },
{ "sgi grey 92","#EAEAEA" }
},
{ // PSA201
{ "MPD", "" },
{ "3D", "" },
{ "PSA202", "" },
{ "sgi grey 92","#EAEAEA" }
}
}
},

.........................................................................................................
04-03 15:01:29.955: E/AndroidRuntime(956): FATAL EXCEPTION: main
04-03 15:01:29.955: E/AndroidRuntime(956): java.lang.ArrayIndexOutOfBoundsException
04-03 15:01:29.955: E/AndroidRuntime(956): at aexp.explist4.Level2ColorExpListAdapter.recalculateLeve3ViewRowCounts(Level2ColorExpListAdapter.java:196)
04-03 15:01:29.955: E/AndroidRuntime(956): at aexp.explist4.Level1ColorExpListAdapter.recalculateLevel2ViewRowCounts(Level1ColorExpListAdapter.java:165)
04-03 15:01:29.955: E/AndroidRuntime(956): at aexp.explist4.Level1ColorExpListAdapter.recalculateRowCounts(Level1ColorExpListAdapter.java:177)
04-03 15:01:29.955: E/AndroidRuntime(956): at aexp.explist4.Level1ColorExpListAdapter$Level2GroupExpandListener.onGroupClick(Level1ColorExpListAdapter.java:221)
04-03 15:01:29.955: E/AndroidRuntime(956): at android.widget.ExpandableListView.handleItemClick(ExpandableListView.java:549)
04-03 15:01:29.955: E/AndroidRuntime(956): at android.widget.ExpandableListView.performItemClick(ExpandableListView.java:527)
04-03 15:01:29.955: E/AndroidRuntime(956): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
04-03 15:01:29.955: E/AndroidRuntime(956): at android.os.Handler.handleCallback(Handler.java:587)
04-03 15:01:29.955: E/AndroidRuntime(956): at android.os.Handler.dispatchMessage(Handler.java:92)
04-03 15:01:29.955: E/AndroidRuntime(956): at android.os.Looper.loop(Looper.java:123)
04-03 15:01:29.955: E/AndroidRuntime(956): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-03 15:01:29.955: E/AndroidRuntime(956): at java.lang.reflect.Method.invokeNative(Native Method)
04-03 15:01:29.955: E/AndroidRuntime(956): at java.lang.reflect.Method.invoke(Method.java:507)
04-03 15:01:29.955: E/AndroidRuntime(956): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-03 15:01:29.955: E/AndroidRuntime(956): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-03 15:01:29.955: E/AndroidRuntime(956): at dalvik.system.NativeStart.main(Native Method)

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
Sorry full string

Sorry full string here,

static final String listdesc[][][][][] =
{
{ // MPD [0]
{ // 2D [0],[0]
{ // PSA101
{ " MPD", "" },
{ " 2D", "" },
{ "PSA101", "" },
{ "lightgrey","#D3D3D3" },
{ "dimgrey","#696969" }
},
{ // PSA102
{ " MPD", "" },
{ " 2D", "" },
{ "PSA102", "" },
{ "lightgrey","#D3D3D3" },
{ "dimgrey","#696969" }
},
{ // PSA103
{ "MPD", "" },
{ "2D", "" },
{ "PSA103", "" },
{ "lightgrey","#D3D3D3" },
{ "dimgrey","#696969" }
}
},
{ // 3D
{ // PSA201
{ "MPD", "" },
{ "3D", "" },
{ "PSA201", "" },
{ "sgi grey 92","#EAEAEA" }
},
{ // PSA201
{ "MPD", "" },
{ "3D", "" },
{ "PSA202", "" },
{ "sgi grey 92","#EAEAEA" }
},
{ // PSA201
{ "MPD", "" },
{ "3D", "" },
{ "PSA202", "" },
{ "sgi grey 92","#EAEAEA" }
}
}
},
{ // blue[1]
{ // lightblue[1][0]
{ // lighterblue
{ "blue", "" },
{ "lightblue","" },
{ "lighterblue","" },
{ "dodgerblue 2","#1C86EE" }
}
}
}
};

paller's picture
Offline
Joined: 11 Apr 2010
Points: 189
Bug

Sorry, there was a bug in the program. I fixed it and uploaded the corrected version where the original was (attached to the initial post)

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
when will u uploaded correct

when will u uploaded correct version of 4-level Expandable listview?

paller's picture
Offline
Joined: 11 Apr 2010
Points: 189
version

Rupal, I have uploaded the fixed version before I responded to your previous comment. I updated the attachment of the original post so please download from the place where you downloaded the previous version from. I have just checked myself, it is the fixed version.

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
Thank you... very much.

Thank you... very much.

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
ListView

when i click in edittext keyboard is shown and my listview is hide coz of that.
so when keyboard is shown in my screen how can i make listview also up..
or any other method using that i can show my list last data..

paller's picture
Offline
Joined: 11 Apr 2010
Points: 189
Keyboard?

Sorry, could you provide a step-by-step scenario, what goes wrong? Yes, the keyboard covers part of the screen when it is active, there is nothing to do with it.

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
I got the Solution....Sorry

I got the Solution....Sorry to Disturb u.....
Thank you

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
it is awesome..it really help

it is awesome..it really help me..u gave exactly that i want.
Thank you

Rupal Thanki's picture
Offline
Joined: 2 Apr 2012
Points: 35
Thanks

Thanks