1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    8
    Vote Rating
    0
    elmogallen is on a distinguished road

      0  

    Question PhoneGap + Sencha Touch loading local XML files

    PhoneGap + Sencha Touch loading local XML files


    Does anyone know the proper way to load a local XML file with PhoneGap and Sencha Touch?

    I've scoured the internet looking for a good solution to this problem, but so far I've not found any good answers...

    The funny thing is -- everything works fine when I deploy to my Droid Incredible, and in my Android 2.2 and 3.0 emulators. It does not work in my Android 2.1 emulator. No data is loaded. The rest of the app works fine in all.

    Code:
    InterviewApp.stores.flashCardStore = new Ext.data.Store({
                model: 'FlashCard',
    
                proxy: {
                	type: 'ajax',
    		        url : 'Questions.xml',
    		        reader: {
    		            type: 'xml',
    		            root: 'InterviewQuestionList',
    		            record: 'InterviewQuestion'
    		        }
                }
            });
    
    InterviewApp.stores.flashCardStore.on('load', function() {
      alert('will never get here');
    });
    
    InterviewApp.stores.flashCardStore.load();
    Again, it works fine on the Droid Incredible and the Android 2.2 and 3.0 emulators. Does not work on Android 2.1 emulator. Everything else works. The app loads fine. It's just my data that never shows up.

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    8
    Vote Rating
    0
    elmogallen is on a distinguished road

      0  

    Default


    This kinda sucks, but I've gotten this to work now by using a combination of Sencha Touch and jQuery. I didn't want to have to add jQuery into the mix... but this works:
    Code:
    $.ajax({
    	type: "GET",
    	url: "Questions.xml",
    	dataType: "xml",
    	async: false,
    	success: function(xml) {
    		$(xml).find('FlashCard').each(function() {
    			flashCards.push({
    				"Question": $(this).find('Question').text(),
    				"Answer": $(this).find('Answer').text(),
    				"Category": $(this).find('Category').text()
    			});
    		});
    	}
    });
    
    InterviewApp.stores.flashCardStore = new Ext.data.Store({
           model: 'FlashCard',
            data: flashCards
    });
    Please, I'm very much open to suggestions for a better way to do this. Preferably using all sencha code.
    Last edited by elmogallen; 29 Jul 2011 at 5:14 AM. Reason: made code look slightly better

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    9
    Vote Rating
    0
    udos86 is on a distinguished road

      0  

    Default


    Hi,

    I did have a similar problem loading local xml files on Android devices using Sencha Touch in combination with PhoneGap.

    My app ran pretty well on both Android and iOs as pure web app. It also worked fine as PhoneGap version on iOS.

    However the PhoneGap version for Android always failed to load the xml data, giving me the following error message :

    Object #<an Object> has no method 'querySelectorAll' at file:///android_asset/www/js/sencha-touch-1.1.0/sencha-touch-debug.js:13201

    This problem occured no matter what Android device or PhoneGap version I was working with.

    Luckily, I could finally fix it by replacing the relative path with absolute URLs.

    Bye

    Udo

  4. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    2
    Vote Rating
    0
    john1224 is on a distinguished road

      0  

    Question Same problem

    Same problem


    A call using AJAX, JSON or YQL causes an issue on Android 2.1

    I have tried my code and kitchen sink using PhoneGap on various android versions and only 2.1 has an issue. I am not the most experienced, little help too please?

  5. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    2
    Vote Rating
    0
    john1224 is on a distinguished road

      0  

    Red face Fixed Android 2.1, Phonegap 1.1.0, Sencha 1.1.1, work for you?

    Fixed Android 2.1, Phonegap 1.1.0, Sencha 1.1.1, work for you?


    Hello!
    I fixed my issue by implementing what is on this post:
    http://www.sencha.com/forum/showthre...negap&langid=4

    Does this work for you?

    If you are looking to implement it in the compressed version it becomes:

    if ((a>= 200 && a< 300) || a== 304 ||
    (a== 0 && d.xhr.responseText.length > 0) ) {



Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."