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 8081453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:44:03+00:00 2026-06-05T16:44:03+00:00

I made a GPS program. I want to send the current address to the

  • 0

I made a GPS program. I want to send the current address to the server. I am getting stuck in the string part. Can you please rectify it. my code is:

                       try {
        Geocoder mGC = new Geocoder(this, Locale.ENGLISH);
        addresses = mGC.getFromLocation(mLocation.getLatitude(),
                mLocation.getLongitude(), 1);
        if (addresses != null) {
            Address currentAddr = addresses.get(0);
            StringBuilder mSB = new StringBuilder("Address:\n");
            for (int i = 0; i < currentAddr.getMaxAddressLineIndex(); i++) {
                mSB.append(currentAddr.getAddressLine(i)).append("\n");
                String a=mSB.toString();
       if(a!=null){

                        HttpClient httpclient = new DefaultHttpClient();
                        HttpPost httppost = new HttpPost(
                                "URL");

                        try {

                            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
                                    1);
                            nameValuePairs.add(new BasicNameValuePair(
                                    "data",a));
                            httppost.setEntity(new UrlEncodedFormEntity(
                                    nameValuePairs));
                            HttpResponse response = httpclient
                                    .execute(httppost);
                            Toast.makeText(getBaseContext(),
                                    response.toString(),
                                    Toast.LENGTH_LONG).show();
                            continue;

}

  • 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-06-05T16:44:05+00:00Added an answer on June 5, 2026 at 4:44 pm

    1- not sure but http connection should not be loop

    2- you created the mSB but not used

    StringBuilder mSB = new StringBuilder("Address:\n");
                for (int i = 0; i < currentAddr.getMaxAddressLineIndex(); i++) {
                    mSB.append(currentAddr.getAddressLine(i)).append("\n");
                   } <----------------- loop should end here 
                    String a= mSB.toString() ;<-------------------------- carete string from mSB
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've made a listener that checks is the GPS status is changed.. i want
Hello i have made a program for my old windows mobile phone to send
I made a simple GPS. app. for android, storing the route coordinates into file.
Made a custom obj called Item with some string fields and one float. .h
I'm trying to add a snap-to-road function in my all custom made GPS software.
I made of subclass of UIView called Bubble using which i want to draw
I made this server class that starts a thread when new connection comes in.
Made a program retrieving .txt files from a folder. Each .txt files contains 1
I have a number of tracks recorded by a GPS, which more formally can
Made a custom post type, Events, great. Now I want to get a second

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.