http - send form and receive response android -
the idea duplicate on android web http://www.telekino.com.ar/ in site there form check if lottery ticket won
i confused on how it. tried @ way
my layout has 3 edittext each 1 of form data sent (emision,cupon,algoritmo), similar web, , button send values. class
public class control extends activity { private edittext numerocarton; private edittext algoritmo; private edittext emision; public static string emision, cupon, algo; public textview resultadocarton; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.control); emision = (edittext)findviewbyid(r.id.emsion); numerocarton = (edittext)findviewbyid(r.id.numerocarton); algoritmo = (edittext)findviewbyid(r.id.algoritmo); emision= emision.gettext().tostring(); cupon= numerocarton.gettext().tostring(); algo= algoritmo.gettext().tostring(); button resultados= (button) findviewbyid(r.id.controlcartonbut); resultados.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { new title().execute(); } }); resultadocarton =(textview)findviewbyid(r.id.resultadocarton); } // title asynctask private class title extends asynctask<void, void, void> { string responsestring; @override protected void onpreexecute() { super.onpreexecute(); } @override protected void doinbackground(void... params) { httpclient client=new defaulthttpclient(); httppost post=new httppost("http://www.telekino.com.ar/"); try { list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(5); namevaluepairs.add(new basicnamevaluepair("emision", emision)); namevaluepairs.add(new basicnamevaluepair("cupon", cupon)); namevaluepairs.add(new basicnamevaluepair("algo", algo)); post.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response=client.execute(post); httpentity entity = response.getentity(); string responsestring = entityutils.tostring(entity, "utf-8"); resultadocarton.settext(responsestring); } catch(exception e){ log.e("exvcx", "error getting data" + e.tostring()); } return null; } @override protected void onpostexecute(void result) { super.onpostexecute(result); resultadocarton.settext(responsestring); } }
}
i dont receive results,and mean there no change on edittext. suggestions? maybe other way create clon
you need know complete endpoint of service getting called after pressing controla button. checked url given you. uses ajax contact webservice , data.
Comments
Post a Comment