I have written an applet and installed it in smart card. But I don\'t know how to read and write data to smart card?
private void readName(APDU apdu) throws
Your card is either contact or contactless. Since you say you have already installed the applet, I assume you have the keys to the card.
If so, in order to communicate with your card you will need to do the following:
And in the response, you will see the bytes you are sending from the Applet:
apdu.setOutgoingLength((short)userName.length);
apdu.sendBytes((short)5, (short)userName.length);
If you need anything more, you will need to provide more details on what you are attempting to accomplish.