×

Discussion Board

Results 1 to 11 of 11

Hybrid View

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    13

    problem in retriving single general number of position 2

    hi all
    i am sucessfull i retriving all contacts including general number but when i try to retrive contact based on detail i am not able to do that like when i try to retrive mobile num, home,fax etc but for some extent i am able to retrive these also
    but general number i am not able to retrive when i try to retrive through detail example

    ---only able to retrive general num when it is in 1 st position exampl

    general:12333
    mobile:1234556


    ----whenever there is general number in btween i am not able to retrive
    exampl
    mobile:1234566
    general:123456789
    home:1234

    the above example i able to retrive

    there is only problem in retriving general number that is in position other than 1st position

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2007
    Posts
    915

    Re: problem in retriving single general number of position 2

    Quote Originally Posted by divya_v View Post
    hi all
    i am sucessfull i retriving all contacts including general number but when i try to retrive contact based on detail i am not able to do that like when i try to retrive mobile num, home,fax etc but for some extent i am able to retrive these also
    but general number i am not able to retrive when i try to retrive through detail example

    ---only able to retrive general num when it is in 1 st position exampl

    general:12333
    mobile:1234556


    ----whenever there is general number in btween i am not able to retrive
    exampl
    mobile:1234566
    general:123456789
    home:1234

    the above example i able to retrive

    there is only problem in retriving general number that is in position other than 1st position

    You are parsing your self or using some inbuilt mechanism. Are you testing on which device or only on emulator ?

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    13

    Re: problem in retriving single general number of position 2

    here is the code:


    Code:
    Int  contnum= c1.countValues(Contact.TEL);
    Int flag=0;
    for(int cont=0;cont<contnum;cont++)
       {  
              tela=c1.getAttributes(Contact.TEL, cont); 
       if ((tela & Contact.ATTR_MOBILE) != 0)
           {
             String connum1=c1.getString(Contact.TEL, cont);
               String con1="M:";
               con1+=connum1;
               connum=connum1;
               flag=1; 
        }
            if ((tela & Contact.ATTR_ HOME) != 0)
           {
             String connum1=c1.getString(Contact.TEL, cont);
               String con1="H:";
               con1+=connum1;
               connum=connum1;
               flag=1; 
        }
     if ((tela & Contact.ATTR_WORK) != 0)
     {
     String connum1=c1.getString(Contact.TEL, cont);
      String con1="w:";
     con1+=connum1;
      connum=connum1;
      flag=1; 
        }
     if ((tela & Contact.ATTR_OTHER) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="o:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    if ((tela & Contact.ATTR_FAX) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="f:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    
    
    if ((tela & Contact.ATTR_AUTO) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="a:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    
    
    if ((tela & Contact.ATTR_ASST) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="ast:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    
    
    
    if ((tela & Contact.ATTR_PREFERRED) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="pff:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    
    
    if ((tela & Contact.ATTR_PAGER) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="pgr:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    
    
    
    if ((tela & Contact.ATTR_SMS) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="sms:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    
    
    if ((tela & Contact.ATTR_NONE) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="none:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    //
    
    
    if ((tela & Contact.ATTR_OTHER) != 0)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="o:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=1;
    }
    //
    
    else
    {
    if(flag!=1)
    {
    String connum1=c1.getString(Contact.TEL, cont);
    String con1="g:";
    con1+=connum1;
    connum=connum1;
    lst1.append(con1,null);
    flag=0;
    }
    }
    flag=0;
    }
    Last edited by divya_v; 2008-12-16 at 09:33.

  4. #4
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: problem in retriving single general number of position 2

    Actually, there can be more than one attributes associated with a single number. In your code, you are assuming that a general number has no other attributes associated with it which may not be the case. Because you can have number like
    General + Mobile
    or General + Fax
    or General + Mobile + Preferred
    and so on...

    You may try following code:

    Code:
    int Attributes;
    Contact ContactObject;
    
    ContactObject = fun(); //fun will search & return a contact
    
    TotalValues = ContactObject.countValues(Contact.TEL);
    for(j = 0; j < TotalValues; j++){
        TelephoneNumber = ContactObject.getString(Contact.TEL, j);
        Attributes = ContactObject.getAttributes(Contact.TEL, j);
    
        if((Attributes & Contact.ATTR_MOBILE) != 0){
            //Mobile
        }
        else if((Attributes & Contact.ATTR_FAX) != 0){
            //Fax
        }
        else if((Attributes & Contact.ATTR_PAGER) != 0){
            //Pager
        }
        else{
            //Landline
        }
    
        if((Attributes & Contact.ATTR_HOME) != 0){
            //Home
        }
        else if((Attributes & Contact.ATTR_WORK) != 0){
            //Work
        }
        else{
            //General
        }
    }

  5. #5
    Registered User
    Join Date
    Nov 2008
    Posts
    13

    Re: problem in retriving single general number of position 2

    but one problem if i try to display number of TEL before entering into for loop i am struct there because its showing the number of TEL numbers leaving general num

    example
    mobile:123345
    general:1234
    home:12345656

    in this i am geeting value as cont=2

    int contnum=c1.countValues(Contact.TEL);
    //displaying contnum --here i am geeting 2 as answer for above exampl
    for(--)
    {
    }



    if general nuber is there in other position its displaying like this
    if general number is in 1 st position i am able to retrive and display also

  6. #6
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: problem in retriving single general number of position 2

    I tried my code on Nokia E61i with
    Mobile General : 123345
    Landline General : 1234
    Landline Home : 12345656
    And I got TotalValues = 3
    And all the 3 numbers were displayed
    On which device/emulator you are running the code?

  7. #7
    Registered User
    Join Date
    Nov 2008
    Posts
    13

    Re: problem in retriving single general number of position 2

    i am testing the code on nokia 6085 S40 on this

  8. #8
    Registered User
    Join Date
    Nov 2008
    Posts
    13

    Re: problem in retriving single general number of position 2

    i am testing on S40 nokia 6085 on this mobile i am tring to exceute

  9. #9
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: problem in retriving single general number of position 2

    Seems to be some problem specific to Nokia 6085...

  10. #10
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: problem in retriving single general number of position 2

    This is a known issue on certain Series 40 models. Unfortunately there is no workaround

    Hartti

Similar Threads

  1. Replies: 6
    Last Post: 2008-08-22, 18:28
  2. fep sms number problem
    By crystal_yujy in forum Symbian User Interface
    Replies: 4
    Last Post: 2008-07-24, 12:28
  3. [moved] Single line text problem
    By lalitjadiya in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-06-21, 10:11
  4. problem in setting the player position
    By mobi1 in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2008-03-13, 11:32
  5. Serial Number Problem
    By koogy in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2002-09-17, 15:51

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×