Webview problems with new SDK

Put your problem here if it does not fit any of the other categories.

Webview problems with new SDK

Postby ryank » Tue Mar 18, 2008 4:07 pm

Has anyone had problems getting the webview to appear when using the new SDK? I had it working with the old SDK but now it just doesn't appear. This is what i have.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <WebView
  2.  
  3. android:id="@+id/myWV"
  4.  
  5. android:layout_width="wrap_content"
  6.  
  7. android:layout_height="wrap_content"
  8.  
  9. android:layout_alignParentTop="true"
  10.  
  11. android:layout_centerHorizontal="true"
  12.  
  13. />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. WebView wv = (WebView) findViewById(R.id.myWV);
  2.  
  3.                 wv.getSettings().setJavaScriptEnabled(true);
  4.  
  5.                 wv.bringToFront();
  6.  
  7.                 wv.setVisibility(View.VISIBLE);
  8.  
  9.                 wv.getSettings().setTextSize(WebSettings.TextSize.NORMAL);
  10.  
  11.                
  12.  
  13.                 StringBuilder data = new StringBuilder();
  14.  
  15.                 data.append("<html><body>TEST</body></html>");
  16.  
  17. wv.loadData(data.toString(), "text/html", "utf-8");
  18.  
  19.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Top

Postby ryank » Wed Mar 19, 2008 1:25 am

What seems even more odd is that it will display fine in debug mode, but not run mode.
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Postby ryank » Fri Mar 21, 2008 3:15 am

Has anyone else ran into this? I can't seem to track it down.
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Postby michael_g_hu » Fri Mar 21, 2008 10:00 am

It probably the the layout width and height.
try to change them from wrap_content to fill_parrent
michael_g_hu
Developer
Developer
 
Posts: 35
Joined: Fri Mar 21, 2008 9:46 am

Postby ryank » Fri Mar 21, 2008 9:49 pm

you were right! Although I couldn't set height to "fill_parent" b/c I just wanted it to fill a certain height. I just set it to the dip I needed and all is good.

Here is my philosophy on what was going on. In debug mode, everything took a little longer to load so the webview had time to load the data. Since I had it set to "wrap_content" initially, the data wasn't loaded so there was virtually no content to wrap the size around.

thanks for your help!
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Alexa [Bot], Exabot [Bot] and 14 guests