Buongiorno a tutti,
Dunque il problema è il seguente.
Anche seguendo pedissequamente nel mio codice le istruzioni espresse nella guida di HTML.it riscontro un problema :
L'evento la funzione : "onPhotoDataSuccess" viene sollevata solo quando io faccio la seconda foto.
Un po' di codice :
codice:
var app = {
onFail : function(message) {
console.log("---CAMERA.onFail");
console.log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
console.log('FAILED TO TAKE A PHOTO: ' + message);
},
onPhotoDataSuccess : function(imageData) {
console.log("---CAMERA.onPhotoDataSuccess");
console.log("fatto : " + imageData);
navigator.notification.alert("FATTO!", function() {
}, "EHILA!");
$("#smallImage").show();
$("#largeImage").show();
$("#largeImage").attr("src", imageData).css({width: "128px", height: "128px"});;
console.log("----------------------------------------------------");
},
// Application Constructor
initialize : function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents : function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
$("#btnSegnala").on("tap", function() {
navigator.camera.getPicture(app.onPhotoDataSuccess,app.onFail);
});
$("#btnSalva").on("tap", scheda.save);
$("#btnInviaSchede").on("tap", scheda.send);
$("#btnExit").on("tap", app.exit);
},
onDeviceReady : function() {
console.log("--- DEVICE READY ---");
},
start : function() {
},
exit : function() {
navigator.notification.confirm("Vuoi uscire dall'applicazione?", function(buttonIndex) {
if (buttonIndex == 1)
navigator.app.exitApp();
}, "Informazione", "Si,No");
}
};
$(document).ready(function() {
app.initialize();
});
Mentre il codice HTML è il seguente :
codice HTML:
<div class="app" >
<div data-role="page" id="homePage">
<div data-role="content">
<a data-role="button" href="#scheda" data-icon="plus" data-iconpos="left" data-theme="b">SEGNALA</a>
<a data-role="button" href="#elencoSchede" data-icon="bars" data-iconpos="left" data-theme="b">NON INVITATE</a>
<a id="btnInviaSchede" data-role="button" href="#page1" data-icon="forward" data-iconpos="left" data-theme="b">VARIE</a>
<a id="btnSegnala" data-role="button" href="#page1" data-icon="forward" data-iconpos="left" data-theme="b">SEGNALA CON FOTO</a>
<img style="display:none;width:60px;height:60px;" id="smallImage" src="img/logo.png" />
<img style="display:none;" id="largeImage" src="" />
</div>
</div>
Tra l'altro viene visualizzata la foto precedente.
Ammetto di essere un po' ritardato con la sintassi di javascript.
Il codice che ho seguito è il seguente
http://www.html.it/pag/45424/gestire...tare-una-foto/
ringrazio per eventuale aiuto.