Posts Tagged app

Getting WebView To Load New Pages

There are a bunch of examples of using WebView to display HTML content loaded from the web in an Android app, including the sample from Google for the WebView class. However the ones I found generally don’t load new pages on their own. I can load up Google, but if you click on anything in the app it launches a browser and takes the user out of the app. The answer to the problem is in the additional points on that Hello, WebView page – you need to set a new WebViewClient to handle the URL load requests. Their example is very helpful, but I prefer to do the override with an anonymous inner class:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WebView webview = new WebView(this);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.setWebViewClient(new WebViewClient() {
        @Override public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
    	    return true;
    	}
    });
    webview.loadUrl("http://google.com");
    setContentView(webview);
}

However, if you follow a link to an image it downloads instead of opens in the view. That’s the same thing the built in browser does, but wasn’t the behavior I expected. I’ll have to figure out how to handle that a bit better.

Tags: , , , , , , ,

No Comments

Launcher Dock

Another widget I’m running now that I have Cupcake installed is “Launcher Dock”. It’s a 1×1 widget that holds launchers for up to 8 apps. I put some of my less frequently launched (but still relatively frequently used) apps in there so that I can have all their icons on the main screen.  This is a shot of my main screen with a configured Launcher Dock by the bottom right corner, just above the San Mateo weather widget:

launcher_dock_1When you tap the widget once it brings up a selector with launchers for each of the apps you’ve added plus an icon to start the widget configuration interface. Here’s what mine looks like after tapping on the widget:

launcher_dock_2And what the configuration interface looks like if you tap on that center icon:

launcher_dock_3I think it’s a pretty slick widget. Great way to increase launcher density if you have a few widgets taking up some space. And it looks pretty good there on the home screen.

Tags: , , , ,

2 Comments

Toggle Settings

Normally I have a few quick toggle applications sitting on my home screen to quickly switch on and off Bluetooth, Wifi, GPS, etc. It really saves a ton of battery life switching off hardware when it’s not in use. I just ran across the free Toggle Settings app from cooolmagic. It has all the hardware switches, some cool status info (like what wifi network you’re connected to), and new toggles for stuff like auto-sync. Very useful, and it looks pretty slick. Just search for “Toggle Settings” in the market and you should find both the 1.1 and 1.5 versions of the app. Here’s a quick rundown of the controls:

  • Turn on and off airline mode
  • Turn on and off autosync
  • Turn on and off bluetooth
  • Turn on and off GPS
  • Turn on and off Wifi, and show what network you’re connected to if you are connected
  • Control the brightness level and screen timeout, or disable screen timeout completely
  • Turn on and off silent mode
  • Control the volume

toggle_settings_1toggle_settings_2

Tags: , , , , , , , ,

No Comments