Mega Search
23.2 Million


Sign Up

Make a donation  
Implementing an interface  
News Group: embarcadero.public.developernetwork.codecentral

Hello,


I am developing an app in firemonkey for ios.  I want to get the count of how many pictures the user has in their camera roll.  I think I found the code but its wrapped in an interface and not sure how to use the interface (below)

{code}
  ///  Interface of images manager 
  IFMXImageManagerService = interface (IInterface)
    ['{F06A5B8F-D4BC-4A0D-AD91-BF49208861E4}']
    ///  Returns the image on an index 
    function GetImage(const Index: Integer): TImageInfo;

    ///  Returns all images from mobile store 
    function GetAllImages: TImages;

    ///  Returns count of all images from mobile store 
    function GetCount: Integer;

    ///  Insert image into mobile store 
    procedure InsertImage(const Bitmap: TBitmap);
  end;  

{code}

How would I use this interface?

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 11-Jun-2013, at 12:37 AM EST
From: Rich Fragiacomo
 
Re: Implementing an interface  
News Group: embarcadero.public.developernetwork.codecentral
Thank you David.  Sorry about the incorrect forum and thanks for the advice!


> {quote:title=David Clegg wrote:}{quote}
> Rich Fragiacomo wrote:
> 
> > How would I use this interface?
> 
> Firstly, this is not the best forum to discuss this, as it is intended
> for discussions about the CodeCentral web site. In future, you may be
> better off posting your iOS questions to
> https://forums.embarcadero.com/forum.jspa?forumID=384
> 
> But to answer your question, you would normally use code similar to the
> following :-
> 
> uses
>   FMX.MediaLibrary, FMX.Platform;
> 
> {$R *.fmx}
> 
> procedure TMainForm.Button1Click(Sender: TObject);
> var
>   lImageManager: IFMXImageManagerService;
> begin
>   if
> TPlatformServices.Current.SupportsPlatformService(IFMXImageManagerServic
> e) then
>   begin
>     lImageManager :=
> TPlatformServices.Current.GetPlatformService(IFMXImageManagerService)
> as IFMXImageManagerService;
>     ShowMessage(Format('There are %d photos on this device',
> [lImageManager.GetCount]))
>   end
>   else
>     Showmessage('IFMXImageManagerService not implemented');
> end;
> 
> 
> However in this case, you will find that you'll always get the
> 'IFMXImageManagerService not implemented' message. This is because
> there doesn't seem to be an implementation of this interface registered
> with the FireMonkey platform services.
> 
> -- 
> Cheers,
> David Clegg
> dclegg@gmail.com
> http://cc.embarcadero.com/author/72299
> QualityCentral. The best way to bug Embarcadero about bugs.
> http://qc.embarcadero.com
> 
> "Oh, yeah, what are you gonna do? Release the dogs? Or the bees? Or the
> dogs with bees in their mouth and when they bark, they shoot bees at
> you?" - Homer Simpson

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 12-Jun-2013, at 4:09 PM EST
From: Rich Fragiacomo