Advertisement

05.05.2008 at 07:32AM PDT, ID: 23376493 | Points: 250
[x]
Attachment Details

Can not update form in J2ME Polish while moving thru GPS

I am using Nokia Prototype 4.0,NetBeans6.0  for building an application for Nokia N82 in J2ME Polish. I am trying to update user's Location through GPS on Screen. I have implemented LocationListener's Functionality in a class named DeviceLocation and I am passing current Form's Object as a Parameter to it so that I can Update the Form from DeviceLocation Class. The Form I am using is J2Me Polish Form. here  is the code snippet from Midlet Class which is calling DeviceLocation's getPosition().
.           StringItem textString = new StringItem("","Getting GPS Data....");
            Form textViewForm= new Form("Text View Form" );
            textViewForm.append(textString);
            display.setCurrent(this.textViewForm);
            deviceLocation.getPosition(textViewForm);

          In Device Location I have written code to get Coordinates and to update the Form on basis of that.
It is running fine on Nokia Emulator it updates the Screen(Form) in specified time Interval  but the Update never Happens on Real Device(Nokia N82). I am not getting the cause of it wheather it is some Security Problem or Form could not be updated like this. I have tried to append() text to Form and also tried to change the text of StringItem both didn't work the Form doesn't update and Neither shows any Exception or alert. If anyone Suggest the Problem or another Approach, it would be a great help for me. The code of DeviceLocation Class  is as follows:
     


public class DeviceLocation implements LocationListener
{

    public LocationProvider provider;
    public Location location;
    public QualifiedCoordinates qc;
    private Coordinates coordinates;
    Form textViewForm;
    String textString;
    StringItem strItem = new StringItem("","Getting GPS Data....");
   
    // getPosition() taking Form as Parameter
    public void getPosition(Form form) {    
        try {
            this.showTextViewForm = form;
            Criteria cr = new Criteria();
            cr.setHorizontalAccuracy(500);
            cr.setVerticalAccuracy(500);
            provider = LocationProvider.getInstance(cr);
            provider.setLocationListener(this, 60, 10, 20);         // set locationListener to Listen on time Interval
        } catch (Exception e) {
            e.printStackTrace();          
        }
    }
    public void locationUpdated(final LocationProvider prov, final Location loc) {
       new Thread() {

            public void run() {
                try {
                    if (loc != null && loc.isValid()) {
                        qc = loc.getQualifiedCoordinates();
                        double lat = qc.getLatitude();
                        double lng = qc.getLongitude();
                        textString = DisplayRecord.calculateDistence();// calculate distance on basis of current Lat/Long
                        strItem.setText(textString);//change text of StringItem
                        textViewForm.set(0, strItem);//replace String Item, here I have tried deleteAll() and append() also but doesn't work
                    } else {

                    }
                }catch (Exception ex) {
                    ex.printStackTrace();
                }
               
            }
        }.start();
    }

    public void providerStateChanged(LocationProvider prov, int newState) {
    }
}
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: nitinv97
Question Asked On: 05.05.2008
Participating Experts: 1
Points: 250
Views: 0
Translate:
Loading Advertisement...
05.05.2008 at 11:12PM PDT, ID: 21505058

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 12:51AM PDT, ID: 21505439

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 02:47AM PDT, ID: 21505881

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 03:53AM PDT, ID: 21506142

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 04:45AM PDT, ID: 21506375

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 03:28AM PDT, ID: 21514853

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 07:01AM PDT, ID: 21516443

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 07:33AM PDT, ID: 21516798

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.05.2008 at 11:12PM PDT, ID: 21505058
Where do you get the GPS data from? Are you connected to the GPS, or are you inserting dummy data? I'd start with the latter, then try to see if the display is updated...
 
05.06.2008 at 12:51AM PDT, ID: 21505439
I am connected with the GPS. But anyway dummy data should also be the same
 
05.06.2008 at 02:47AM PDT, ID: 21505881
What I mean is: are you completely sure that your app communicates correctly with the GPS; and therefore that you are dealing with a GUI issue? Try to isolate the problem.

The emulator doesn't help much in these cases... you must try on the device.
 
05.06.2008 at 03:53AM PDT, ID: 21506142
Problem is not from the GPS as we can get different lat/long. Also in our approach we have added a refresh button which is calling to the same page and it is working fine. But from the listener, it is not repainting for the different lat/long
 
05.06.2008 at 04:45AM PDT, ID: 21506375
Did you try calling the refresh button from the Listener?
 
05.07.2008 at 03:28AM PDT, ID: 21514853
I do not have control on listener thread. As refresh button in itself is working fine so now I trying another approach. Now I am creating a different thread when it is reaching to any form. This thread is calling refresh function. Now whenever I am going out of this form, I am stopping this thread. Let me try this approach and then I will update you

One more thing in my initial approach, this was working fine on the emulator but not on the real device.
 
05.07.2008 at 07:01AM PDT, ID: 21516443
Michele when I tried to run a different thread and called the refresh function then it is working now.
 
05.07.2008 at 07:33AM PDT, ID: 21516798
Good!
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628