tags:

views:

13

answers:

0

Hi all,

I done already Exporting Part..using toSerialFormat..

but i have struggle in Importing Part..

I had wrote this function..

InputStream contents are comes from Server(PHP)...

But i Got error..I run this one,it ll always goes catch block.. i m beginner in j2me...dats why i can't figure out..

if any one know ...please suggest me..

void importContact(InputStream is)       
{

        System.out.println("Enter the Import Function");

//      DataInputStream qpis = new DataInputStream(is);

//    QuotedPrintableInputStream qpis = new QuotedPrintableInputStream(is);

    try 

    {

        System.out.println("Enter the Import Function in TrY BlOcK");

       // PIMItem[] items = PIM.getInstance().fromSerialFormat(qpis, "UTF-8");

        PIMItem[] items = PIM.getInstance().fromSerialFormat(is, "UTF-8");

         contact = (Contact) (items[0]);

        ContactList cl = (ContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, 
PIM.READ_WRITE);

        cl.importContact(contact);

        System.out.println("C="+contact);

        System.out.println("C L="+cl);

        System.out.println("Successfully Contact imported");

    }  

    catch(PIMException pe) 

    {

        System.out.println("Enter the Import Function in CaTcH BlOcK PIMExcepTIoN");

    } 

    catch(IOException ioe) 

    {

        System.out.println("Enter the Import Function in CaTcH  BlOcK IoExCePtIoN");

    }

        System.out.println("OuT oF Import Function");

}