Package com.gwtmobile.phonegap.client.Contacts

Examples of com.gwtmobile.phonegap.client.Contacts.Contact


        break;
      }
    }

    public void create() {
    final Contact contact = Contacts.newInstance();
    contact.setDisplayName("Plumber");
    contact.setNickname("Plumber");
   
    ContactName name = ContactName.newInstance();
    name.setGivenName("Jane");
    name.setFamilyName("Doe");
    contact.setDisplayName(name.getGivenName() + " " + name.getFamilyName());
    contact.setName(name);
   
    contact.save(new Callback() {     
      @Override
      public void onSuccess() {
        text.setHTML("Contact " + contact.getName().getGivenName() + " "
            + contact.getName().getFamilyName() + " created.");
      }     
      @Override
      public void onError(ContactError error) {
        text.setHTML("Contact creation failed.<br/>" + error.getCode());
      }
View Full Code Here


    Contacts.find(new ContactFields("nickname", "name"), new ContactFindCallback() {
      @Override
      public void onSuccess(JsArray<Contact> contacts) {
        if (contacts.length() > 0) {
          for (int i = 0; i < contacts.length(); i++) {
            final Contact contact = contacts.get(i);
            contact.remove(new Callback() {
              @Override
              public void onSuccess() {
                text.setHTML(contact.getNickname() +
                    " (" + contact.getName().getGivenName() +
                    " " + contact.getName().getFamilyName() +
                    ") removed.<br/>" + text.getHTML());
              }
              @Override
              public void onError(ContactError error) {
                text.setHTML(text.getHTML() + "<br/> Failed to remove contact. " + error.getCode());
View Full Code Here

    private void cloneContact() {
    Contacts.find(new ContactFields("nickname", "name"), new ContactFindCallback() {
      @Override
      public void onSuccess(JsArray<Contact> contacts) {
        if (contacts.length() > 0) {
          final Contact contact = contacts.get(0);
          final Contact clone = contact.clone();
          clone.getName().setGivenName(clone.getName().getGivenName() + "-Clone");
          clone.getName().setFamilyName(clone.getName().getFamilyName() + "-Clone");
          clone.setNickname(clone.getNickname() + "-Clone");
          clone.setDisplayName(clone.getDisplayName() + "-Clone");
          clone.save(new Callback() {
            @Override
            public void onSuccess() {
              text.setHTML(clone.getNickname() +
                  " (" + clone.getName().getGivenName() +
                  " " + clone.getName().getFamilyName() +
                  ") saved.<br/>");
            }
            @Override
            public void onError(ContactError error) {
              text.setHTML(text.getHTML() + "<br/> Failed to save cloned contact. " + error.getCode());
View Full Code Here

        break;
      }
    }

    public void create() {
    final Contact contact = Contacts.newInstance();
    contact.setDisplayName("Plumber");
    contact.setNickname("Plumber");
   
    ContactName name = ContactName.newInstance();
    name.setGivenName("Jane");
    name.setFamilyName("Doe");
    contact.setDisplayName(name.getGivenName() + " " + name.getFamilyName());
    contact.setName(name);
   
    contact.save(new Callback() {     
      @Override
      public void onSuccess() {
        text.setHTML("Contact " + contact.getName().getGivenName() + " "
            + contact.getName().getFamilyName() + " created.");
      }     
      @Override
      public void onError(ContactError error) {
        text.setHTML("Contact creation failed.<br/>" + error.getCode());
      }
View Full Code Here

    Contacts.find(new ContactFields("nickname", "name"), new ContactFindCallback() {
      @Override
      public void onSuccess(JsArray<Contact> contacts) {
        if (contacts.length() > 0) {
          for (int i = 0; i < contacts.length(); i++) {
            final Contact contact = contacts.get(i);
            contact.remove(new Callback() {
              @Override
              public void onSuccess() {
                text.setHTML(contact.getNickname() +
                    " (" + contact.getName().getGivenName() +
                    " " + contact.getName().getFamilyName() +
                    ") removed.<br/>" + text.getHTML());
              }
              @Override
              public void onError(ContactError error) {
                text.setHTML(text.getHTML() + "<br/> Failed to remove contact. " + error.getCode());
View Full Code Here

    private void cloneContact() {
    Contacts.find(new ContactFields("nickname", "name"), new ContactFindCallback() {
      @Override
      public void onSuccess(JsArray<Contact> contacts) {
        if (contacts.length() > 0) {
          final Contact contact = contacts.get(0);
          final Contact clone = contact.clone();
          clone.getName().setGivenName(clone.getName().getGivenName() + "-Clone");
          clone.getName().setFamilyName(clone.getName().getFamilyName() + "-Clone");
          clone.setNickname(clone.getNickname() + "-Clone");
          clone.setDisplayName(clone.getDisplayName() + "-Clone");
          clone.save(new Callback() {
            @Override
            public void onSuccess() {
              text.setHTML(clone.getNickname() +
                  " (" + clone.getName().getGivenName() +
                  " " + clone.getName().getFamilyName() +
                  ") saved.<br/>");
            }
            @Override
            public void onError(ContactError error) {
              text.setHTML(text.getHTML() + "<br/> Failed to save cloned contact. " + error.getCode());
View Full Code Here

TOP

Related Classes of com.gwtmobile.phonegap.client.Contacts.Contact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.