java - How to get API_KEY in Android Transliteration -
need help... working on transliteration in android , requires api_key, i'm new android, don't know how api_key, can tell me, have api_key...? in advance...!! following code snippet---
public class mainactivity extends activity { edittext myinputtext; button mytranslatebutton; textview myoutputtext; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); myinputtext = (edittext)findviewbyid(r.id.inputtext); mytranslatebutton = (button)findviewbyid(r.id.translatebutton); myoutputtext = (textview)findviewbyid(r.id.outputtext); mytranslatebutton.setonclicklistener(mytranslatebuttononclicklistener); } private button.onclicklistener mytranslatebuttononclicklistener = new button.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub string inputstring; string outputstring = null; inputstring = myinputtext.gettext().tostring(); try { googleapi.sethttpreferrer("http:\\www.google.com"); **// here need api_key** **googleapi.setkey(" api key");** outputstring = translate.default.execute(inputstring,language.english, language.hindi); } catch (exception ex) { ex.printstacktrace(); outputstring = "error"; } typeface customf = typeface.createfromasset(getassets(), "akshar.ttf"); //final textview textv = (textview) findviewbyid(...); myoutputtext.settypeface(customf); myoutputtext.settext(outputstring); } }; }
follow following steps,
1) sign in here google account
2) click on link developers.google.com [at bottom left]
3) click on link api console [at bottom left]
4) (if first time) screen display 'start using google apis console' , click on create project
5)below google api logo ,click on drop down list , select create
6)enter name project , click create project
7) activate ever service want => i.e. on service check in i agree... , click accept
8)click on api access [left side] , here required api key
or link can you
Comments
Post a Comment