Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4074498
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:10:41+00:00 2026-05-20T17:10:41+00:00

I am writing a program about drawing a route of a person with using

  • 0

I am writing a program about drawing a route of a person with using initial GPS values of that person.

To do that I have implemented all locationListener code and I put all coordinate values into a vector. But the problem that I have now is that, I want to put them into mySQL and I dont know how to send a vector to Php file. Can you please help me with that ?

Note : I do not want to send values via URL so thats why I want to send the whole vector.

package project;

import java.util.Vector;

import javax.microedition.location.Location;
import javax.microedition.location.LocationException;
import javax.microedition.location.LocationListener;
import javax.microedition.location.LocationProvider;

import net.rim.device.api.gps.BlackBerryCriteria;
import net.rim.device.api.gps.BlackBerryLocationProvider;
import net.rim.device.api.gps.GPSInfo;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.MainScreen;

public class RoutePaint extends MainScreen implements LocationListener,
        FieldChangeListener {

    public double latitude;
    public double altitude;
    public double longitude;
    public float velocity;
    public Vector locations;

    private BlackBerryCriteria myCriteria;
    private BlackBerryLocationProvider myProvider;
    private Point point;

    private ButtonField locVector;


    public RoutePaint() {

        locations = new Vector();
        locVector = new ButtonField("Locations Vector",
                ButtonField.CONSUME_CLICK);
        locVector.setChangeListener(this);


        add(locVector);

        myCriteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
        try {
            myProvider = (BlackBerryLocationProvider) LocationProvider
                    .getInstance(myCriteria);

        } catch (LocationException e) {

            e.printStackTrace();
        }
        myProvider.setLocationListener(this, 3, -1, -1);

    }

    public void locationUpdated(LocationProvider provider, Location location) {
        // TODO Auto-generated method stub
        point = new Point();
        latitude = location.getQualifiedCoordinates().getLatitude();
        altitude = location.getQualifiedCoordinates().getAltitude();
        longitude = location.getQualifiedCoordinates().getLongitude();
        velocity = location.getSpeed();
        point.x = latitude;
        point.y = longitude;

        locations.addElement(point);

        invalidate();
    }

    public void providerStateChanged(LocationProvider arg0, int arg1) {
        // TODO Auto-generated method stub

    }

    public boolean onClose() {

        Dialog.inform("Exiting project!");
        System.exit(0);
        return true;
    }

    public void fieldChanged(Field field, int context) {

        if (field == locVector) {
            getUiEngine().pushScreen(new LocationsVector(locations));
        }
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:10:41+00:00Added an answer on May 20, 2026 at 5:10 pm

    OK, the overall game plan is:

    1. what you need is to send data using a POST request ("Content-Type" header should be "application/x-www-form-urlencoded").
    2. you should use your custom data format to be sent over the net, so the data can be easily parsed in PHP script.
    3. inside of your PHP script you get the data, parse it to an array of Points and use SQL to put it to the DB.

    A sample post data in your case could look as the following:

    point_1_x=12.34&point_1_y=12.34&point_2_x=14.34&point_2_y=14.34
    

    Here for a Point you have a pair of params (point_N_x and point_N_y, where N is index in your Vector). However the exact format is up to you. The only reason to know the format is to be able to write a parser on web part. I am sure you are able to generate smth similar (most likely more compact) by iterating through the Vector.

    Googling you can find some examples on how to send a POST request on BB. For instance, look here and here as a starting point. Also make sure you have studied the official API (scroll to “Example using POST with HttpConnection”).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For about a year I have been thinking about writing a program that writes
I'm starting to learn about COBOL. I have some experience writing programs that deal
Im writing a program that should read input via stdin, so I have the
I have been writing a program that is quite complex compared to what I
I had a friend ask me about writing a program that would allow data
I am writing a program that is using a database library. The library provides
I'm writing a program that is using the functions sin() and cos() from the
I've been writing a program that can determine any and every data about an
I'm thinking about writing a program that asks the user to think of an
I am writing a program that is supposed to help me learn about enumeration

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.