Android developer's guide book

Google IO - major trends: Google Wave, GWT, HTML5

The conference was packed with a lot of classes presented in parallel  so I was not able to attend most of them, but from my own perspective that is what I learned (more on each topic in separate articles).

1) Google Wave will change the way we do things on the Web
2) Google Web Toolkit (GWT) is the right technology of the future, I am glad we did not go with Flex
3) Google Friend Connect is a must for any socially engaged website
4) HTML 5 will rock the Internet;  "Web is the platform" not the particular mobile OS
5) Google AppEngine will dramatically change how development of the new apps happens
6) Android operating system for mobile phones has a bright future, even if it does not match iPhone

Click here for more information:


Google IO - free HTC "Magic" G2 phone

This year's all of the attendees of Google IO conference in San Francisco were nicely suprised by a generous gift of the newest HTC "Magic" (AKA G2, currently on ebay for $405) UNLOCKED Android phone, along with the T-mobile unlimited 3G 1 month SIM card. 

The new handset has a very beautiful design similar and on par with iPhone, no external keyboard.


Thank you Google IO!


The Android operating system, in my opinion, does not come close to the user experience provided by almost 2 year old iPhone, as if Google did not learn anything during this time, but the situation for Android is now that simple...

Couple of the challenges Android team faces are the patents Apple has on some of their cool solutions (hand gestures) as well as not knowing on what hardware configuration the Android will run: keyboard, or now, trackball, or not, flip screen, or not, screen size, etc.

I see a bright future for Android even if it may not be able to match iPhone in it's user experience. 

Android is open source and written in Java which automatically enables thousands more developers to improve it, and write applications comparing to relative handful Objective-C developers for iPhone. 

With time many manufacturers will be releasing phones with Android as their operating system, I am sure that trend will increase and Android will "graduate" from it's current status of "geeky, Linux-like mobile OS" to the "Microsoft of mobile OS" as far as number of users goes and hopefully close to the Mac's user experience. 

Enable JavaScript on Internet Explorer (IE8)

If you are getting a blank page with only the background image appearing, it is possible that your security setting does not allow JavaScript.
Click on any photo to enlarge it.
Open:
Tools menu -> Internet Options -> select Security tab -> click on "Custom Level" button
Make sure that "Scripting" is enabled:
Click "Apply" button.
Verify that the page appears correctly.

Enable JavaScript on FireFox (All versions)

If you browser security permissions are too strict, the JavaScript may be disabled. Since JavaScript does not pose a security risk,you can enable it as follows:
Check "Enable JavaScript" (Click on the photo to enlarge it)

Enable JavaScript on Internet Explorer (IE6)

If you browser security permissions are too strict, the JavaScript may be disabled. Since JavaScript does not pose a security risk,you can enable it as follows:
Open Tools menu -> Internet Options -> select Security tab -> click on "Custom Level" button (Click to enlarge the photo)
SOn some pages you may need ActiveX controls enabled:
Make sure Scripting options are enabled (Click to enlarge the photo)
Click "Apply" button (Click to enlarge the photo)

Product design & focus groups

The product, or a feature, should be always designed with the new user
in mind
. If a new user can use it, the power user will find it a bliss.

"Less is more" -- try to avoid the feature creep, or hanging bells and
whistles just because it is possible, or just because you think they
might be useful. The iPod originally was supposed to have FM radio and
a voice recorder, yet Apple decided against that, despite user feedback.


Have a concise, clear definition of the product, from the
beginning. Make 100% sure user understands it intuitively.

The hardest thing in product development is to determine what NOT to
include
, how to simplify the user experience. An average customer who
returns a gadget, does so not because it did not work, but because
they could not figure it out in first 20 minutes.

"Creativity in art and technology is about individual expression. Just
as an artist couldn't produce a painting by conducting a focus group,
Apple doesn't use them either. Jobs can't innovate by asking a focus
group what they want -- they don't know what they want."

Henry Ford once said: "If I'd asked my customers what they wanted,
they'd have said a faster horse.
"

Observe new users and find out what needs to be refined in the
product, but they cannot tell you what they want, you have to discover
it yourself. All Sony's market research indicated that a Walkman was
going to fail, yet Akio Marita pushed on with his vision and it became
one of the most popular products ever sold. Customers usually don't
know what they want unless it has been already created, and if it was
already created you should not be in this business.

Spend time and effort refining the basic functionality before adding
the next feature. Original, pre-Steve Jobs OS X team had 1 designer on
staff doing ugly gray boxes, after Steve took over they would spent 2
weeks on a single scroll bar until they made it perfect.

As a leader, be strong about these principles, don't give in to the
"design by comitee", or your product will fail.

When the design is good enough?

It is really hard to say when you stop telling your designer "keep
working on it", be it user interface, or functionality. After a few
iterations you may start asking yourself -- am I just unreasonably
annoying? Is this good enough?

I found the answer from Apple's Steve Jobs:

"We made the buttons on the screen look so good you'll want to lick
them."

Fourtune, January 24, 2000

Browser URL encoding for &

Browser does not display urls with & character, to resolve this issue I wrote a method to convert & to its encoded value:

private String replaceSpecialChar(String originalImagePath)

{

int indexAmp = originalImagePath.indexOf("&");

if (indexAmp > -1)

originalImagePath = originalImagePath.replaceAll("&", "%26");

int indexSpace = originalImagePath.indexOf(" ");

if (indexSpace > -1)

originalImagePath = originalImagePath.replaceAll(" ", "%20");

return originalImagePath;

}

Printing in GWT

Good source on printing in GWT: http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/eea48bafbe8eed63

This worked for me!

Internet Explorer 8 compatibility issues

Using GWT, I had an issue with pop up panels not showing content in IE8 so in order to force the compatibility mode in IE8 to turn on, I added this html script which you have to put inside a meta tag:

equiv="X-UA-Compatible" content="IE=EmulateIE7"

Also another issue with GWT/IE is that in the html we assign class="hidden" to our page, but in order to make our page visible again we can't use:
RootPanel.get("page").addStyleName("visible");

We must use the code below for IE:
RootPanel.get("page").getElement().getStyle().setProperty("visibility", "visible");

Reflections of a frustrated programmer & IEx

A wise programer wrote:
"fix your code, compile, test Internet Explorer,
frown... Fix IE6, test IE7.... Frown a little more, fix again, test
IE8-as-IE7, smile, test IE8-as-IE8, swear, drink more coffee, fix IE8,
laugh..."

How to clear browser cache for CSS files

Every time you change external files like CSS (Cascading style sheets), you have to clear cache on the browser to see the changes. Clearing cache on application load is a a frustrating step for users. Here is a solution:
Add a questions mark and  string to the end of the UTL of the CSS fil, example "?version=xx.xx.x". On application load, the browser will think that this is a new CSS file, but when it parses it it will get the file name with out the "?flush=1". 
Caching:

<link rel="stylesheet" href="css/html_tags.css?version=xx.xx.xx" type="text/css">

NOT caching

<link rel="stylesheet" href="css/html_tags.css" type="text/css">:

Ref:

Email to SMS

You can text via email to any major provider. The below site explains how this works. I tested using a gmail account and an AT&T phone, and I was even able to reply to my email account. If you don't have a phone with a mail client, you could get your emails forwarded to your phone via text.

http://www.makeuseof.com/tag/email-to-sms/

Software Tool: OmniGraffle

Recently I have been using OmniGraffle, which is an excellent tool for software design. It has tools like diagrams, flow charts, etc.
OmniGraffle download:

Prevent image selection and dragging behavior

When writing JavaScript that allows images to be dragged and dropped on a web page, the browser's default drag and selection behavior can get in the way. Here are cross-browser ways to disable these default behaviors...

Prevent selection:
HTML
<img style="moz-user-select: none" unselectable="on" onseletstart="return false;" />

or JavaSript
function preventSelection(element) {
element.style.MozUserSelect = 'none';
element.unselectable = 'on';
element.onselectstart = function() { return false; };
}

Prevent drag for images and links:
HTML
<img onmousedown="return false;" ondragstart="return false;" />

or JavaScript
function preventDrag(element) {
element.onmousedown = function() { return false; };
element.ondragstart = function() { return false; }; //I.E.
}