Hi all,
I have been using NXP JCOP environment along with Gemalto Developer Suite (for Mobile Simulator) to develop and test my applications. I have been facing a very odd problem which i not able to solve.

My problem is related to Menu traversal, ie When my menu structure appears on the phone, (Root Menu) i select a particular menu item say "App Dev". Then it list me few items,now i select "GetInp", then do a GetInput to accept the input say "123" , i press ok. Now instead of going back to the list under AppDev . it goes back to the root menu where the "RootMenu" is listed under SIM menu.

So my application looks very odd for any menu operation as i have to start from root again selecting every thing. I tried various PDU setting in Menu, List, Display Text , Get Input but failed. Now i am stuck. :-(

My Menu construction is as this (not complete code)
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.APDU;
import javacard.framework.Util;


/
public class menuSelect extends Applet {



private static final byte PROACTIVE_CMD_SET_UP_MENU = (byte) 0x25;
private static final byte PROACTIVE_CMD_SELECT_ITEM = (byte) 0x24;
private static final byte PROACTIVE_CMD_GET_INPUT = (byte) 0x23;


private static final byte MENU_SELECT = (byte) 0x44;
private static final byte STKMENU_NUMBER = (byte) 0x0B;

// MENU CONSTRUCTION */
private static final byte[] PROACTIVE_SETUP_MENU = {
(byte) 0x81, CMD_DTL_LENGTH, CMD_NUMBER, PROACTIVE_CMD_SET_UP_MENU, (byte) 0x00,
(byte) 0x82, (byte) 0x02, DEVICEID_SIM, DEVICEID_ME,
(byte) 0x85, (byte) 0x08, 'R', 'o', 'o', 't','M', 'e', 'n', 'u',
(byte) 0x8F, (byte) 0x09, STKMENU_NUMBER, 'A', 'p', 'p', 's', ' ', 'D', 'e', 'v',
(byte) 0x18, (byte) 0x01, (byte) 0x24,

};

// SELECTION ITEMS
private static final byte[] PROACTIVE_SELECT_ITEM = {
(byte) 0x81, CMD_DTL_LENGTH, CMD_NUMBER, PROACTIVE_CMD_SELECT_ITEM, (byte) 0x00,
(byte) 0x82, (byte) 0x02, DEVICEID_SIM, DEVICEID_ME,
(byte) 0x05, (byte) 0x08, 'A', 'p', 'p', 's', ' ', 'D', 'e', 'v',
(byte) 0x8F, (byte) 0x09, 1, 'D', 'i', 's', 'p', 'T', 'e', 'x', 't',
(byte) 0x8F, (byte) 0x07, 2, 'G', 'e', 't', 'I', 'n', 'p',
(byte) 0x8F, (byte) 0x09, 3, 'S', 'e', 'n', 'd', ' ','S','M','S',
(byte) 0x8F, (byte) 0x0C, 4, 'S', 'e', 't', 'u', 'p',' ',' ','C','a','l','l',
(byte) 0x8F, (byte) 0x05, 5, 'E', 'x', 'i', 't',
};

public static void install(byte[] bArray, short bOffset, byte bLength) {
// GP-compliant JavaCard applet registration
new menuSelect().register(bArray,
(short) (bOffset 1), bArray[bOffset]);
}

public void process(APDU apdu) {
if (selectingApplet()) {
return;
}
logAPDU.LogIncoming(apdu);
switch (buf[ISO7816.OFFSET_CLA]) {

insVal = buf[ISO7816.OFFSET_INS];
switch (insVal) {



case INS_TERMINAL_RESPONSE:

byte cmdType = buf[ISO7816.OFFSET_CDATA+3];

case INS_FETCH:
fetchcode = 0;
switch (fetchcmd) {

case PROACTIVE_CMD_SET_UP_MENU:
buf[0] = (byte) 0xD0; buf[1] = (byte) PROACTIVE_SETUP_MENU.length;
Util.arrayCopy(PROACTIVE_SETUP_MENU, (short) 0, buf, (short) 2, buf[1]);
apdu.setOutgoingAndSend((short) 0, (short) (buf[1] 2)); // Add 2 to payload length to account for header: 0xD0 & length byte
//shouldFetch((byte) PROACTIVE_SELECT_ITEM.length);
fetchcode = 0;
break;


case PROACTIVE_CMD_SELECT_ITEM:
switch (choosenMenuItem) {
case STKMENU_NUMBER:
buf[0] = (byte) 0xD0; buf[1] = (byte) PROACTIVE_SELECT_ITEM.length;
Util.arrayCopy(PROACTIVE_SELECT_ITEM, (short) 0, buf, (short) 2, (short) PROACTIVE_SELECT_ITEM.length);
apdu.setOutgoingAndSend((short) 0, (short) (PROACTIVE_SELECT_ITEM.length 2));
//shouldFetch((byte) PROACTIVE_SELECT_ITEM.length);
break;

case 1 :
buf[0] = (byte) 0xD0; buf[1] = (byte) (DISPLAY_TEXT1.length);
Util.arrayCopy(DISPLAY_TEXT1, (short) 0, buf, (short) 2, (short) (buf[1]));
apdu.setOutgoingAndSend((short) 0, (short) (buf[1] 2)); // Add 2 to payload length to account for header: 0xD0 & length byte
choosenMenuItem = STKMENU_NUMBER;
break;
}
break;


} // Case default
} // Switch
}

If any one can help me it would be really helpful...

Prakash