{"id":3560,"date":"2014-03-28T10:37:04","date_gmt":"2014-03-28T10:37:04","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/28\/translate-in-android-using-google-api-collection-of-common-programming-errors\/"},"modified":"2014-03-28T10:37:04","modified_gmt":"2014-03-28T10:37:04","slug":"translate-in-android-using-google-api-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/28\/translate-in-android-using-google-api-collection-of-common-programming-errors\/","title":{"rendered":"Translate in Android using Google API-Collection of common programming errors"},"content":{"rendered":"<p>I want to create a translate app in Android,i use Google Translate API,but it has error,please help me for fix it. This is my code<\/p>\n<pre><code>public void onClick(View v) {\n        \/\/ TODO Auto-generated method stub\n        String InputString;\n        String OutputString = null;\n        InputString = InputText.getText().toString();\n\n        try {\n\n            Translate.setHttpReferrer(\"http:\/\/translate.google.com.vn\/\");\n            OutputString = Translate.DEFAULT.execute(InputString, Language.ENGLISH, Language.VIETNAMESE);    \/\/\/\/\/\/\/\/\n\n        } catch (Exception ex) {\n            ex.printStackTrace();\n            OutputString = \"Error\";\n\n        }\n\n        OutputText.setText(OutputString);               \n    }   \n<\/code><\/pre>\n<p>Here is my Manifest<\/p>\n<pre><code>\n\n    \n\n    \n        \n            \n                \n\n                \n            \n        \n    \n\n\n<\/code><\/pre>\n<p>Error in line <strong>Translate.setHttpReferrer(&#8220;http:\/\/translate.google.com.vn\/&#8221;);<\/strong><\/p>\n<pre><code>The method setHttpReferrer(String) is undefined for the type Translate\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I want to create a translate app in Android,i use Google Translate API,but it has error,please help me for fix it. This is my code public void onClick(View v) { \/\/ TODO Auto-generated method stub String InputString; String OutputString = null; InputString = InputText.getText().toString(); try { Translate.setHttpReferrer(&#8220;http:\/\/translate.google.com.vn\/&#8221;); OutputString = Translate.DEFAULT.execute(InputString, Language.ENGLISH, Language.VIETNAMESE); \/\/\/\/\/\/\/\/ } catch [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3560","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3560"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3560\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}