Hi, i'm new in jquery mobile, but i allready like it !
I'm trying to use the file transfer with Jquery mobile and cordova on android,
i use this tutorial to practice: http://blog.revivalx.com/2014/05/03/tutorial-camera-cordova-plugin-for-ios-and-android/
After selecting the picture, this function is call on success:
function onPhotoDataSuccess(imageURI) { navigator.notification.alert("onPhotoDataSuccess Image URI: "+imageURI, function() {}); var cameraImage = document.getElementById('image'); cameraImage.style.display = 'block'; cameraImage.src = imageURI; }
The notification show me the good file URI, so i presume it's ok, but when the application come back to the webview, the whole "page" and it's content disappear from the screen and another page appears, this page is the launcherpage that is displayed untill the device is ready, when it's ready, i change the page to login page.
<div id="launcherPage" data-role="page" data-theme="b"> <h1>Loading...</h1> </div>
So i tried and changed this function with this code:
function onPhotoDataSuccess(imageURI) { navigator.notification.alert("onPhotoDataSuccess Image URI: "+imageURI, function() {}); $('#image').attr({ src: imageURI, style: "display:block;width:100%;" }); }
But i have the same result, there is no duplicate ids, i don't really understand why it's doing that.
Here is the html code:
<div data-role="page" id="picture" data-theme="b"> <div data-role="header"> <h1>TEST</h1> </div><!-- /header --> <div data-role="content" data-theme="b"> <form id="pictureForm"> <button onclick="capturePhoto();">Capture Photo</button><br> <button onclick="getPhoto(pictureSource.PHOTOLIBRARY);">From Photo Library</button> <img id="image" src="" style="display:none;width:100%;"> <label for="title">Title</label> <input data-clear-btn="true" name="title" id="title" value="" type="text"> <input value="Continue" type="submit" id="adButton" onclick="uploadPhoto();"> </form> </div><!-- /content --> <div data-role="footer" data-theme="b"> <h4>TEST</h4> </div><!-- /footer --> </div><!-- /page -->
Thank you for your help
EDIT I've noticed that when the launcherPage is displayed after the picture selection, if i tap my phone's back button, it displays the picture page correctly with the selected image included...
EDIT 2 When i comment the launcherPage from the html code, after the picture selection, it displays the login page...