Hi Mark,

I was having the same issue. What worked for me was changing the
layout_height of the WebView from "wrap_content" to "fill_parent".
Depending on your UI you may also want to add a layout_weight of "1".

I'm not sure why if layout_height is set to wrap_content that the
WebView doesn't seem to get click messages. This might be a bug. I'm
using 1.0_r2.

Hopefully that will fix your issue too.

Frank


On Jan 29, 1:32 pm, Mark Nuetzmann <mark.nuetzm...@gmail.com> wrote:
> I have a simplewebviewclient that gets the content from a url and
> loads it into theWebView.  When the activity starts and the first
> data is loaded into theWebViewit works beautifully.  I can click the
> href of the image returned in the url data and theWebViewlaunches
> the browser just fine.  However, if I then update the contents of 
> theWebViewwith another call to loadData, theWebViewdisplays the new
> data but you cannot click on anything in theWebView...
>
> I do not see any logs like
>
> Starting activity: Intent { action=android.intent.action.VIEW
> categories={android.intent.category.BROWSABLE}
> in the log viewer...
>
> If I relaunch my activity, it again works the first time but not for
> additional content.  Is there something else I am supposed to do to
> get theWebViewto support the clicking of hrefs in the data that was
> loaded?
>
> thanks, Mark
>
> public class SampleWebviewClient extends Activity {
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         Button btn = (Button) findViewById(R.id.nexturl_btn);
>         btn.setOnClickListener(mOnClickNextUrl);
>
>         new Thread(mGetUrlData).start();
>     }
>
>     OnClickListener mOnClickNextUrl = new OnClickListener() {
>             @Override
>             public void onClick(View arg0) {
>                 new Thread(mGetUrlData).start();
>             }
>     };
>
>     private List<String> mQueuedUrls = new ArrayList<String>();
>     private Runnable mGetUrlData = new Runnable() {
>                 @Override
>                 public void run() {
>                         String data = getUrlData();
>                         if (data != "") {
>                                 mQueuedUrls.add(data);
>                                 runOnUiThread(mUpdateImage);
>                         }
>                 }
>     };
>
>     private Runnable mUpdateImage = new Runnable() {
>                 @Override
>                 public void run() {
>                        WebViewwebView= (WebView) findViewById(R.id.webkit);
>                         if (webView!= null) {
>                                webView.loadData(mQueuedUrls.get(0), 
> "text/html", "utf-8");
>                                 mQueuedUrls.remove(0);
>                         }
>                 }
>     };
>
>         public String getUrlData() {
>            String data = ... get the data...
>             return data;
>     }
>
> }
>
> main.xml
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
> <TextView
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     android:text="something above"
>     />
> <WebView
>         android:id="@+id/webkit"
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>         />
> <TextView
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     android:text="something below"
>     android:layout_weight="1"
>     />
>  <Button
>         android:id="@+id/nexturl_btn"
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     android:text="   Get Next Url   "
>     />
> </LinearLayout>

--~--~---------~--~----~------------~-------~--~----~
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