×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    14

    UX string element not showing on form

    The string helloText, with location information, is not showing up on the UI. What am I missing here ?

    Code:
    public class UpdateJourney extends Form implements CommandListener, Runnable {
    	private LocationProvider myLocation;
    	private Criteria myCriteria;
    	private Location myCurrentLocation;
    
    	private HomeScreen helloScreen;
    	private Command exitCommand;
    
    	private Thread getLocationThread = new Thread(this);;
    
    	public UpdateJourney(HomeScreen helloScreen) {
    		super("Taxeeta");
    
    		this.helloScreen = helloScreen;
    		getLocationThread.start();
    	}
    
    	public double getMyLatitude() {
    		return myCurrentLocation.getQualifiedCoordinates().getLatitude();
    	}
    
    	public double getMyLongitude() {
    		return myCurrentLocation.getQualifiedCoordinates().getLongitude();
    	}
    
    	public void commandAction(Command command, Displayable arg1) {
    		if (command == exitCommand) {
    			helloScreen.notifyDestroyed();
    		}
    	}
    
    	public void run() {
    		myCriteria = new Criteria();
    		myCriteria.setHorizontalAccuracy(500);
    		try {
    			myLocation = LocationProvider.getInstance(myCriteria);
    			myCurrentLocation = myLocation.getLocation(60);
    		} catch (LocationException e) {
    			e.printStackTrace();
    			System.out
    					.println("Error : Unable to initialize location provider");
    			return;
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    			System.out.println("Error: Waited enough for location to return");
    			return;
    		}
    		System.out.println("Location returned Lat:"
    				+ myCurrentLocation.getQualifiedCoordinates().getLatitude()
    				+ " Lng:"
    				+ myCurrentLocation.getQualifiedCoordinates().getLongitude());
    		String helloText = new String("Location returned Lat:"
    				+ myCurrentLocation.getQualifiedCoordinates().getLatitude()
    				+ " Lng:"
    				+ myCurrentLocation.getQualifiedCoordinates().getLongitude());
    		super.append(helloText);
    
    		exitCommand = new Command("Location returned Lat:"
    				+ myCurrentLocation.getQualifiedCoordinates().getLatitude()
    				+ " Lng:"
    				+ myCurrentLocation.getQualifiedCoordinates().getLongitude(),
    				Command.EXIT, 1);
    		addCommand(exitCommand);
    		setCommandListener(this);
    
    	}
    
    }
    Last edited by taxeeta; 2013-04-02 at 13:54.

  2. #2
    Regular Contributor
    Join Date
    Mar 2005
    Location
    Hamburg, Germany
    Posts
    283

    Re: UX string element not showing on form

    Hello Siddharth,

    Are you sure that the Update-Journey Form is displayed at all?
    It need to be made current with Display.setCurrent(displayable)-method somewhere in your other code.

    I would change the code that you create the StringItem in the constructor,
    and then you only change the text of the item after you get the position.
    By doing this, you them know if there is a problem with you user interface code or if there is a problem with your location finding code:

    Code:
    // instance variable:
    StringItem resultItem; 
    ...
    // in constructor:
    resultItem = new StringItem("Location:","not known yet");
    append(resultItem);
    ...
    // at end of run method:
    resultItem.setText(helloText);
    Reagrds

    Karsten Meier
    Regards

Similar Threads

  1. takes two string form user and show the concatenated string result in new dialog box
    By swaraj.prasad@gmail.com in forum Symbian User Interface
    Replies: 3
    Last Post: 2011-03-17, 10:27
  2. Showing a Form/uidesign
    By neverma in forum Symbian
    Replies: 6
    Last Post: 2010-02-19, 09:36
  3. Hiding form element
    By raxitsheth in forum Mobile Java General
    Replies: 1
    Last Post: 2009-12-16, 17:51
  4. Nokia N95 Midlet not displaying form element
    By vanpersie17 in forum Mobile Java General
    Replies: 18
    Last Post: 2009-02-26, 12:23
  5. image input element types in form -problem
    By seanos11 in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2004-11-01, 15:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×