I'm almost willing to go out on a limb and say that if I don't sleep for more then a second after loadUrl() then the page doesn't show. When I sleep for 1 second, sometimes the page will not show and sometimes the page will draw 1/2 way and then stop. If I sleep for 3 or more seconds, the page will show ( relatively ) consistently. At this point, all I do is this:
mainPage.loadUrl("http://commonsware.com"); Thread.sleep(3000); I should try some other web pages, but google.com and yahoo.com both don't show up. It's also curious to me that if the page shows up 1/2 way or enough to reveal the <home> link at the top, I can click on the home link and it will display the whole page. This all seems a bit flakey to me. One thing I might add is that I'm running through eclipse ( 3.3.2 ). On Jun 3, 11:15 am, "Mark Murphy" <[EMAIL PROTECTED]> wrote: > > Thank you for your help. So, what is this book you speak of...? > > _The Busy Coder's Guide to Android Development_. Version 0.9 is available > in PDF and Kindle form on the CommonsWare Web site. A more formal > announcement is forthcoming. > > > I've > > modified my code according to your suggestions. I've also added a > > couple other tests to see if I get output. Curious thing is that the > > only time I see any output on the screen is when I load 'http:// > > commonsware.com'. None of the other attempts show anything on the > > screen. No real errors, just nothing shows up, however > > commonsware.com does show. > > I broke into the Google servers and hacked the WebKit code to only show > the CommonsWare site. > > Note to Google: that's a joke. Honest. > > > > > > > public void onCreate(Bundle icicle) { > > super.onCreate(icicle); > > setContentView(R.layout.main); > > try { > > mainPage = (WebView) findViewById(R.id.webView); > > mainPage.loadData( > > "<html><body>Hello World!</body></html>", > > "text/html", "utf-8"); > > > Thread.sleep(60000); > > > mainPage.loadData( > > "<html><body><img src=\"file:///android_asset/ > > Winter.jpg\"></body></html>", > > "text/html", "utf-8"); > > > Thread.sleep(60000); > > > mainPage.loadData( > > "<img src=\"file:///android_asset/Winter.jpg\">", > > "image/jpeg", "utf-8"); > > > Thread.sleep(60000); > > mainPage.loadUrl("http://commonsware.com"); > > > Thread.sleep(60000); > > } catch (Exception e) { > > android.util.Log.e("Exception : ", e.getMessage()); > > } > > } > > That code works? > > The reason I ask is that the Android docs mention that if your activity > doesn't return from callbacks like onCreate() quickly, Android will > consider the activity stuck or dead and will get rid of it. I hadn't > experimented with that feature in the emulator, but I had figured it was > already in there. I would think that minute-long sleep periods in > onCreate() ought to trigger the scavenger, but apparently not. > > I seem to recall that accessing the Google Web site was hit or miss, but I > wrote that off as being something peculiar to them perhaps doing > browser-sniffing and causing Android's WebKit some problems. I can say > thathttp://commonsware.comuses nothing more complicated than CSS -- no > Javascript, no server-side smarts (until you get to the Warescription > ecommerce piece), etc. > > Have you tried visiting these other sites in the built-in Browser > application? If they work there, but not in your activity, that might > trigger some ideas. But, beyond that, off the top of my head, I don't know > what might be going wrong. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ -- Available Now!- Hide > quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---