clearPictures Method

This command will remove all photos from your application's picture list.

intel.xdk.camera.clearPictures();

Available Platforms:

Events:

  • intel.xdk.camera.picture.clear: This event is fired once the clearPictures method has completed. It will return a parameter indicating whether it was successful or not.

Example:


document.addEventListener("intel.xdk.camera.picture.clear",onClear); 

alert(intel.xdk.camera.getPictureList().length + " items in the picture list");
intel.xdk.camera.clearPictures();

function onRemove(evt)
{
  var arrPictureList = intel.xdk.camera.getPictureList();
  for (var x=0;x<arrPictureList.length;x++)
  {
    // create image 
    var newImage = document.createElement('img');
    newImage.src=intel.xdk.camera.getPictureURL(arrPictureList[x]);
    newImage.setAttribute("style","width:100px;height:100px;");
    newImage.id=document.getElementById("img_" + arrPictureList[x]);
    document.body.appendChild(newImage);
  }
  if(evt.success==true)
  {
    alert("The picture list has been cleared");
  }
}
            
如需更全面地了解编译器优化,请参阅优化注意事项