Blackberry how to display message in app if device got no internet connection?
Posted
by Johannes
on Stack Overflow
See other posts from Stack Overflow
or by Johannes
Published on 2010-04-29T14:48:32Z
Indexed on
2010/04/30
11:27 UTC
Read the original article
Hit count: 495
blackberry
|browserfield
Hello
I've just started with programming for the Blackberry device. I'm using version 5 of the API.
I'm building a very simple application which is just a browserfield. So far it's all working great. I can display my browserfield with the content I need.
The problem I'm having now is if the device doesn't have an active internet connection I get the ugly "Error requesting content for" message.
I would need to someone display my own message if the device doesn't have an active connection.
Something like "You need to have an active internet connection to use this application" with an Exit button which closes the app.
I've tried to find this for hours but no luck.
Hopefully it's something relatively easy so I can get help here.
Here's my code so far:
package com.mycompany.webview;
import net.rim.device.api.browser.field2.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
public class webview extends UiApplication
{
public static void main(String[] args)
{
webview app = new webview();
app.enterEventDispatcher();
}
public webview()
{
pushScreen(new webviewScreen());
}
}
class webviewScreen extends MainScreen
{
public webviewScreen()
{
BrowserField myBrowserField = new BrowserField();
add(myBrowserField);
myBrowserField.requestContent("http://www.google.com");
}
}
Would really appreciate some help please.
Thanks
© Stack Overflow or respective owner