Skip to main content

jQueryMobile in a weekend

I played with jQueryMobile during the weekend and was really surprised by the productivity you get with the framework. In like 4hrs I was able to create a great looking app that was running with any major glitches on my Android phone. Now when I compare that to the challenges I was experiencing when coding with Android :)

Some lessons learned from the weekend:
- Good IDE for javascript is a must. Aptana really rules in that area, you can add it to your Android Eclipse installation easily - http://aptana.com/products/studio3/download

- There are challenges on Android when you move between pages of the app. The whole screen blinks. Apparently you need to disable the transition effect on Android, like below:


$.mobile.defaultDialogTransition = "none";
$.mobile.defaultPageTransition = "none";


- I18N is not built into the jQM, but there are some interesting workarounds, like http://stackoverflow.com/questions/8134555/jquery-mobile-json-processing-before-mobile-enhancements

- listening for the hardware back button is really easy:


document.addEventListener("backbutton", function(e) {
if($.mobile.activePage.is('#welcomeScreen')) {
e.preventDefault();
navigator.app.exitApp();
} else {
navigator.app.backHistory()
}
}, false);

but the issue is that it didnt work with jQM 1.0.1. It seems to work perfectly with 1.1.rc1 though (it has another bug, that makes it unusable, but that's another story).

- You can easily tap into the area clicked event with the following code:


$(document).find('AREA').bind('click', function(e) {
$.mobile.changePage("#youNewPage");
}

- Reading and setting values from the jQueryMobile inputs is also easy:

currentValue = $('#myComponentId').val();
$('#myComponentId ').val("NEW VALUE HERE"); // here we're setting the value

- Hiding and Showing buttons created with <a> tag is not easy. You need to envelope then with <div> tag and hide that div, so for example:

$("#btnMyButton").parent().hide(); // hide the button
$("#btnMyButton").parent().show(); // show the button

- Afaik there is no way to define a fragment of the code and reuse it on multiple screens. So you end up with defining the footer zillion times (once per screen).

In the end - I really liked jQM. Definition of the UI was intuitive (it's HTML with additional attributes), debugging was painless, google helped a lot :)

Comments

Popular posts from this blog

Eclipse + EGit - "The authenticity of host ... can't be established" challenge

Recently while writing new Android code I decided that it's the highest time to have a Git repository not only on my hard drive, but also safe in the Internet. After quick search and finding out that I have accounts at almost every popular service that provides Git hosting, I figured out that one that covers everything I need (wiki, bug tracking, code hosting, forums) is the good old sourceforge. I used it also with no problems few months ago on another mobile project, so I was hoping that pushing code there will be a piece of cake. But then when I tried to do it (after configuring the project on the sourceforge site), I got very interesting error: ssh://USER@git.code.sf.net:22: org.eclipse.jgit.transport.CredentialItem$YesNoType:The authenticity of host 'git.code.sf.net' can't be established. RSA key fingerprint is 86:7b:1b:12:85:35:8a:b7:98:b6:d2:97:5e:96:58:1d. Are you sure you want to continue connecting? In theory it's nothing bad, you press the "Y

HTTPS for dummies - so how HTTPS really works in 5 mins

What is HTTPS? HTTPS (HyperText Transfer Protocol Secure) is a way of transferring data over internet in a secure manner. It's achieved through adding SSL (Secure Socket Layer)/TLS (Transport Layer Security) on top of standards HTTP. What HTTPS gives us? End-2-end encryption of data - from the browser to the server and back = even if someone reads the data you are sending, they will not be able to understand anything out of it Confirmation of the identity of the website we are accessing = you are sure that the website that looks like your bank is actually your bank (and not a phishing website) How does it work? First you need a pair of SSL certificates: One installed in your web browser (in most cases shipped together with your browser, provided by one of so-called trusted Certificate Authorities) One installed on the website (which is acquired by the website owner) Each of those SSL certificates includes the following information:  Public information: name of

How to make Logitech Trackball Marble Wheel work

If you bought Trackball Marble from Logitech, the first challenge you encounter is probably related to the lack of the wheel button. Unfortunately the software provided with the device for Windows doesn't help (neither Universal or Auto Search aren't really working as I was expecting). Internet suggests mostly one option, app called Marble Mouse Scroll Wheel http://marble-mouse-scroll-wheel.software.informer.com/ To some extent it works, but I wasn't able to make it work in google maps or in picture viewer. Moreover setting where crashing very often (I am running windows 7 64 bits). Fortunately there is a way to have a semi-wheel button behavior with this trackball, but with a different software - X-Mouse Button Control: http://www.highrez.co.uk/downloads/XMouseButtonControl.htm Setup Mouse button 4 and 5 as wheel up and wheel down. Then also update Logitech SetPoint settings to replace the behavior of those button to default. Voila - now you can emulate wheel