Ask away

Android Calling JavaScript functions in Button

Kevin 11/12/17 08:46


Question CategoryMiscellaneous

Number of completed projects0

Question StatusUnsolved

  • android
  • js
  • button


I've got a Button that button need to access some Javascript function. Simply my app get the user info(ID,pass) then go to web page(this operation doing backgrun with asynctask class) write these two info as ID and pass then user click the Log In button in my app button has to use some js function <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> this is the func. i need to use My post and get request for connection the site are POST// URL url = new URL(params[0]); // site= connection=(HttpURLConnection) url.openConnection(); connection.setDoOutput(true); OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(data); writer.flush(); these codes for the put the ID and pass GET // reader= new BufferedReader((new InputStreamReader(connection.getInputStream()))); StringBuilder builder = new StringBuilder(); String line; while((line= reader.readLine())!=null){ builder.append(line + "\n"); } text=builder.toString(); there is any help or suggestion for me i am very confused about that situation and i feel really bad myself thanks for helps anyway.