Jump to content

William23668

Members
  • Content Count

    121
  • Joined

  • Last visited

Posts posted by William23668


  1. @programmerdelphi2k

    I tried like you said but still number was not added. Also sometimes I get stackoverflow erro and external exception 78 error

     

    procedure TForm1.ActionAddContactExecute(Sender: TObject);
    var
      Contact: TAddressBookContact;
      Phones: TContactPhones;
      eMails: TContactEmails;
      Photo: TBitmapSurface;
    begin
      Contact := AddressBook1.CreateContact(FDefaultSource);
      try
        try
          Contact.FirstName := edtFirstName.Text;
          Contact.LastName := edtLastName.Text;
    
          Phones := TContactPhones.Create;
          try
            Phones.AddPhone(TContactPhone.TLabelKind.Mobile, '767867679678');
            Contact.Phones := Phones;
          finally
            Phones.Free;
          end;
    
          if not Image1.Bitmap.Size.IsZero then
          begin
            Photo := TBitmapSurface.Create;
            try
              Photo.Assign(Image1.Bitmap);
              Contact.Photo := Photo;
              Image1.Bitmap.SetSize(0, 0);
            finally
              Photo.Free;
            end;
          end;
          // Add the work mail
          eMails := TContactEmails.Create;
          try
            eMails.AddEmail(TContactEmail.TLabelKind.Work, edtWorkMail.Text);
            Contact.eMails := eMails;
          finally
            eMails.Free;
          end;
          // Save a newly created contact to Address Book
          AddressBook1.SaveContact(Contact);
    
        except
          on E: EAddressBookException do
            ShowMessage('Cannot create the contact.' + E.Message);
        end;
    
        // Add the contact to the selected group, if any
        try
          if InRange(ComboBox1.ItemIndex, 0, FGroups.Count - 1) then
            AddressBook1.AddContactIntoGroup
              (FGroups.Items[ComboBox1.ItemIndex], Contact);
        except
          on E: EAddressBookException do
            ShowMessage('Cannot add the newly created contact to group.' + E.Message);
        end;
    
        ListViewContacts.BeginUpdate;
        try
          AddListViewItem(Contact);
        finally
          ListViewContacts.EndUpdate;
        end;
        TabControl1.ActiveTab := TabItemContacts;
      finally
        Contact.Free;
      end;
      // Clear the Add Contact Form
      ClearAddContactForm;
    end;

     


  2. Hi

     

    I was trying to add phone number in the address book demo like that hard coded but the number was never saved, why is that ?

     

    Contact.Phones.AddPhone('Home', '767867679678');

     

    procedure TForm1.ActionAddContactExecute(Sender: TObject);
    var
      Contact: TAddressBookContact;
      eMails: TContactEmails;
      Photo: TBitmapSurface;
    begin
      Contact := AddressBook1.CreateContact(FDefaultSource);
      try
        try
          Contact.FirstName := edtFirstName.Text;
          Contact.LastName := edtLastName.Text;
          Contact.Phones.AddPhone('Home', '767867679678'); //<<<--------
          if not Image1.Bitmap.Size.IsZero then
          begin
            Photo := TBitmapSurface.Create;
            try
              Photo.Assign(Image1.Bitmap);
              Contact.Photo := Photo;
              Image1.Bitmap.SetSize(0, 0);
            finally
              Photo.Free;
            end;
          end;
          // Add the work mail
          eMails := TContactEmails.Create;
          try
            eMails.AddEmail(TContactEmail.TLabelKind.Work, edtWorkMail.Text);
            Contact.eMails := eMails;
          finally
            eMails.Free;
          end;
          // Save a newly created contact to Address Book
          AddressBook1.SaveContact(Contact);
    
        except
          on E: EAddressBookException do
            ShowMessage('Cannot create the contact.' + E.Message);
        end;
    
        // Add the contact to the selected group, if any
        try
          if InRange(ComboBox1.ItemIndex, 0, FGroups.Count - 1) then
            AddressBook1.AddContactIntoGroup
              (FGroups.Items[ComboBox1.ItemIndex], Contact);
        except
          on E: EAddressBookException do
            ShowMessage('Cannot add the newly created contact to group.' + E.Message);
        end;
    
        ListViewContacts.BeginUpdate;
        try
          AddListViewItem(Contact);
        finally
          ListViewContacts.EndUpdate;
        end;
        TabControl1.ActiveTab := TabItemContacts;
      finally
        Contact.Free;
      end;
      // Clear the Add Contact Form
      ClearAddContactForm;
    end;

     


  3.  

     

    interface
    
    uses
      System.SysUtils, System.Types, System.UITypes, System.Classes,
      System.Variants, System.Permissions, FMX.Types, FMX.Controls, FMX.Forms,
      FMX.Graphics, FMX.Dialogs, Vcl.ComCtrls, Commctrl,
      FMX.AddressBook.Types, FMX.AddressBook, FMX.StdCtrls, FMX.SearchBox,
      FMX.Layouts, FMX.ListBox, FMX.Controls.Presentation, FMX.Edit, FMX.TabControl,
      FMX.Platform, System.Actions, FMX.ActnList, FMX.ListView.Types,
      FMX.ListView.Appearances, FMX.ListView.Adapters.Base, FMX.ListView,
      FMX.StdActns, FMX.MediaLibrary.Actions, FMX.Objects, FMX.Surfaces;
      
      ....
    
    procedure TForm1.FormShow(Sender: TObject);
    var
    LItem: TListItem;
    begin
      LItem := TListItem.Create(ListViewContacts.Items);
      LItem.Text := 'new item';

    @programmerdelphi2k thanks but still same error.

     

    image.thumb.png.19dc9230e97bc6ffceb2a8003d8b5d52.png


  4. Hi

     

    It is FMX app but I just want to test adding items from code in Windows so I used that code from here

     

    var
    LItem: TListItem;
    begin
      LItem := TListItem.Create(ListViewContacts.Items);
      LItem.Caption := 'new item';

    I added "Commctrl" to uses clause but "Caption" is not defined, why ?


  5. 10 minutes ago, Dave Nottage said:

    Which version of Delphi are you using? Which version of Android is on the device? Have you tried running the app via the debugger to check whether there's any errors?

    Delphi 11.2 with October patch. Android 10. Tried the debugger only the splash screen appear and stop at it

     

    this is all I see:

     

    image.png.e21d070095a18970b06acdcf919c962a.png


  6. Hi

     

    I use Delphi 11.2 and I am trying to conenct it to my android device honor 8x . I followed all the steps

     

    https://docwiki.embarcadero.com/RADStudio/Sydney/en/Running_Your_Android_Application_on_an_Android_Device

    https://docwiki.embarcadero.com/RADStudio/Sydney/en/Configuring_Your_System_to_Detect_Your_Android_Device

    https://docwiki.embarcadero.com/RADStudio/Sydney/en/Installing_the_USB_Driver_for_Your_Android_Device

     

    but I got dizzy and I am unable to find device usb driver I tried google usb driver did not work

    http://developer.android.com/sdk/win-usb.html

     

     

    OEM driver also I dont know where to find

    https://developer.android.com/studio/run/oem-usb

    https://consumer.huawei.com/en/support/

     

    the phone is visible in device manager

     

    image.thumb.png.a01a0300bb1c112a6319baa70a47e898.png

     

    image.thumb.png.c90989c4acb2f269e9901b751eb2176d.png

     

    image.thumb.png.3c62e8f1e90bdc37e9e346658c66d759.png

     

    image.thumb.png.1971d10c32969bed55343440c9da5bf5.png

     

     \extras folder in your installed <SDK> directory, only contain folder called intel.

     

    What I am missing ?

     

     

     

     

     

     

×