int AlbumSave(char *filename, void (*callback)(int type));

 

Displays a modal picker dialog allowing the user to select a photo from the device's saved photos or camera roll.

 

Return Value

 

Returns zero if the modal window could not be displayed, nonzero otherwise.

 

Parameters

 

filename

Name of the file to be saved to the app's Documents folder.

 

callback

Function to be called back when the modal window is dismissed.  The type parameter specifies whether the user chose to cancel or accept the specified photo.  0=cancel; 1=accept.

 

Remarks

 

Allows the user to select a preexisting photo from the device's photo library and save it to the app's Documents folder with the specified file name.

 

Availability

 

Available in DragonFireSDK 2.0 and later.

 

Example

 

This example brings up either the Photo Album picker or the Camera picker and lets the user save a photo to the app's Documents folder.  If the picture is saved, it is displayed on the screen.

 

#include "DragonFireSDK.h"

 

int im;

int vw;

 

void OnGetPicture(int type)

{

  if (type)

   {

       ImageSetImage(im, "Documents/MyPicture.png");

       ViewSetSize(vw, 300, 380);

   }

  else

   {

       printf("User canceled saving the picture");

   }

}

 

int OnButton(int id)

{

  switch (id)

   {

  case 1:

       AlbumSave("MyPicture.png", OnGetPicture);

      break;

  case 2:

       CameraSave("MyPicture.png", OnGetPicture);

      break;

   }

     

  return(id);

}

 

void AppMain()

{

   ButtonAdd("Images/Button", 10, 10, OnButton, 1);

   ButtonAdd("Images/Button", 10, 50, OnButton, 2);

 

   im=ImageAdd("Images/Placeholder.png");

 

   vw=ViewAdd(im, 10, 90);

}

 

void AppExit()

{

 

}

 

void OnTimer()

{

 

}