example.http
Class PushExample

java.lang.Object
  extended by javax.microedition.midlet.MIDlet
      extended by example.http.PushExample
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener

public class PushExample
extends javax.microedition.midlet.MIDlet
implements javax.microedition.lcdui.CommandListener

An example MIDlet to fetch a page using an HttpConnection. Refer to the startApp, pauseApp, and destroyApp methods so see how it handles each requested transition.


Field Summary
(package private)  javax.microedition.lcdui.Alert alert
          user interface alert component.
(package private) static int DefaultTimeout
           
(package private)  javax.microedition.lcdui.Display display
          current display.
(package private)  javax.microedition.lcdui.Command exitCommand
          user interface command for indicating Exit request.
(package private)  boolean imageLoaded
           
(package private)  javax.microedition.lcdui.Image newsHoundImage
           
(package private)  java.lang.String url
          current requested url.
(package private)  javax.microedition.lcdui.List urlList
          user interface component containing a list of URLs
(package private)  java.util.Vector urls
          array of current URLs
 
Constructor Summary
PushExample()
          initialize the MIDlet with the current display object.
 
Method Summary
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable s)
          Respond to commands, including exit
 void destroyApp(boolean unconditional)
          Destroy must cleanup everything.
 void pauseApp()
          Pause signals the thread to stop by clearing the thread field.
(package private)  void setupList()
          Check the attributes in the descriptor that identify url's and titles and initialize the lists of urls and urlList.
 void startApp()
          Start creates the thread to do the timing.
 
Methods inherited from class javax.microedition.midlet.MIDlet
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DefaultTimeout

static final int DefaultTimeout
See Also:
Constant Field Values

exitCommand

javax.microedition.lcdui.Command exitCommand
user interface command for indicating Exit request.


urlList

javax.microedition.lcdui.List urlList
user interface component containing a list of URLs


urls

java.util.Vector urls
array of current URLs


alert

javax.microedition.lcdui.Alert alert
user interface alert component.


newsHoundImage

javax.microedition.lcdui.Image newsHoundImage

imageLoaded

boolean imageLoaded

display

javax.microedition.lcdui.Display display
current display.


url

java.lang.String url
current requested url.

Constructor Detail

PushExample

public PushExample()
initialize the MIDlet with the current display object.

Method Detail

startApp

public void startApp()
Start creates the thread to do the timing. It should return immediately to keep the dispatcher from hanging.

Specified by:
startApp in class javax.microedition.midlet.MIDlet

pauseApp

public void pauseApp()
Pause signals the thread to stop by clearing the thread field. If stopped before done with the iterations it will be restarted from scratch later.

Specified by:
pauseApp in class javax.microedition.midlet.MIDlet

destroyApp

public void destroyApp(boolean unconditional)
Destroy must cleanup everything. The thread is signaled to stop and no result is produced.

Specified by:
destroyApp in class javax.microedition.midlet.MIDlet
Parameters:
unconditional - true if a forced shutdown was requested

setupList

void setupList()
Check the attributes in the descriptor that identify url's and titles and initialize the lists of urls and urlList.

The attributes are named "ViewTitle-n" and "ViewURL-n". The value "n" must start at "1" and increment by 1.


commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable s)
Respond to commands, including exit

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener
Parameters:
c - user interface command requested
s - screen object initiating the request