Do you need to display the webpage? Or you are just interested in the value
if the hidden input? How is the other value supposed to be sent back to the
server, is it via javascript, is it a html form or something else?

2011/7/6 sabanim <rickd...@gmail.com>

> OK so it does not need to be webview but that's the closest I have
> gotten to solving my problem. (going on 2 weeks now).
>
> ok so right now I am using a webview to go and see a page. On that
> page is a hidden input tag with an id and value.
> I need to pull that value and use it in java.  Eventually I need to
> send something also.  I have this all working in a blackberry webworks
> app using javascript and ajax.
>
> I think I'm close but I cant seem to modify my code to get the right
> result.  with this code I can get all the html on the page but not
> just the one thing I want. This is put into an alert.
>
> How do I get just the value and then how do I get it so the java will
> read it.
>
> client code:
> ~~~
> public class button3 extends Activity{
>
>         WebView wb = null;
>
>         /** Called when the activity is first created. */
>         @Override
>         public void onCreate(Bundle savedInstanceState) {
>          super.onCreate(savedInstanceState);
>          setContentView(R.layout.buttons);
>          wb = new WebView(this);
>          wb.setWebViewClient(new HelloWebViewClient());
>          wb.getSettings().setJavaScriptEnabled(true);
>          wb.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
>                  /* WebViewClient must be set BEFORE calling loadUrl! */
>          wb.setWebViewClient(new WebViewClient() {
>              @Override
>              public void onPageFinished(WebView view, String url)
>              {
>                  /* This call inject JavaScript into the page which just
> finished loading. */
>
>
> wb.loadUrl("javascript:window.HTMLOUT.showHTML(document.getElementsByTagName('html').innerHTML);");
>
>              }
>          });
>          wb.loadUrl("http://www.whateverurl.com";);
>          setContentView(wb);
>         }
>
>
>
>         private class HelloWebViewClient extends WebViewClient {
>
>          public boolean shouldOverrideUrlLoading(WebView view, String url)
> {
>           view.loadUrl(url);
>           return true;
>          }
>         }
>
>         final Context myApp = this;
>          class MyJavaScriptInterface
>          {
>              public void showHTML(String html)
>              {
>                  new AlertDialog.Builder(myApp)
>                      .setTitle("Value of Hidden ID")
>                      .setMessage(html)
>                      .setPositiveButton(android.R.string.ok, null)
>                  .setCancelable(false)
>                  .create()
>                  .show();
>              }
>          }
> ~~~
>
> html code:
> ~~~
> Lunch<br><img src='http://www.?????/mimages/image002.jpg'
> style="width: 300px;" ><br><p><input type='hidden' id='sendtextcoupon'
> value='0'>
>                  Do You SEE THIS</p>
> ~~~
>
> Any help would be great!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to