Google Translate API in Android App-Collection of common programming errors

How can I use Google Translate API and translate text in an android app? I tried this:

http://code.google.com/p/google-api-translate-java/

but it doesn’t work. I have an Api Key too. My code is(according to official example):

    GoogleAPI.setHttpReferrer("http://mysite.com");
    GoogleAPI.setKey("My Key");
    String translatedText = Translate.DEFAULT.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH);

I put this code in my main Activity but I get an error: "Unhandled exception type GoogleAPIException" and there is a suggestion to fix that error: "Surrond with Try/Catch". But when I changed code to:

try {
String translatedText = Translate.DEFAULT.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH);
    } catch (GoogleAPIException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

my code runs correctly but I can’t get any response (translated text). I set this permission too:

Where is my mistake?

  1. I think the problem is in google itself, since last autumn, they are close free usage of Translation API.

    On the API documentation page it says:

    Important: Google Translate API v2 is now available as a paid service only, and the number of requests your application can make per day is limited. As of December 1, 2011, Google Translate API v1 is no longer available; it was officially deprecated on May 26, 2011. These decisions were made due to the substantial economic burden caused by extensive abuse. For website translations, we encourage you to use the Google Website Translator gadget.