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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:29:40+00:00 2026-06-10T01:29:40+00:00

I have a long URL that is being built using nameValuePairs and I’m currently

  • 0

I have a long URL that is being built using nameValuePairs and I’m currently trying to figure out why the post is resulting in a 500 error on some devices while getting a 200 on other devices. I need to extract the full URL from the httppost although as I understand it should just be in the format of:

http://xx.com/site.asmx?var1=blah?var2=blah

And the same build works on phones while not working on tablets. I’ve tried looking through my code and catching any places where a tablet may not be able to define such variables like this case:

final TelephonyManager tm = (TelephonyManager) getBaseContext()
                .getSystemService(Context.TELEPHONY_SERVICE);
        String tmDevice;
        try{
        tmDevice = "" + tm.getDeviceId().toString();
        }
        catch (NullPointerException e)
        {
            tmDevice = "null";
        }

Here is what some of the nameValuePairs look like and an excerpt from the posting part of the code:

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
    nameValuePairs
            .add(new BasicNameValuePair("CurrentOwnerUsername", name));
    nameValuePairs.add(new BasicNameValuePair("OSVersion",
            Build.VERSION.RELEASE));
    nameValuePairs.add(new BasicNameValuePair("hash",
            "xxx"));
    nameValuePairs.add(new BasicNameValuePair("OSName", "Android"));
    nameValuePairs.add(new BasicNameValuePair("Model", Build.MODEL));
    nameValuePairs.add(new BasicNameValuePair("Manufacturer",
            Build.MANUFACTURER));
    nameValuePairs.add(new BasicNameValuePair("IMEI", id));
    try {
        nameValuePairs.add(new BasicNameValuePair("SerialNumber",
                Build.SERIAL));
    } catch (NoSuchFieldError e) {
        nameValuePairs.add(new BasicNameValuePair("SerialNumber",
                "NotAvailable"));
    }
    nameValuePairs.add(new BasicNameValuePair("CarrierName", carrier));
    // .add(new BasicNameValuePair("FriendlyName", Build.DEVICE));
    nameValuePairs.add(new BasicNameValuePair("Type", " "));
    nameValuePairs.add(new BasicNameValuePair("VisitorID", VisitorID));
    nameValuePairs.add(new BasicNameValuePair("PhoneNumber", phoneNumber));
    nameValuePairs.add(new BasicNameValuePair("SSID", ssid));
    nameValuePairs.add(new BasicNameValuePair("MACAddress", macAddr));
    nameValuePairs.add(new BasicNameValuePair("UserDepartment",
            department_val));
    nameValuePairs.add(new BasicNameValuePair("BatteryLevel", batteryText));

    int toastDuration = Toast.LENGTH_SHORT;
    try {
        HttpPost httppost = new HttpPost(URL); // post object
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost); // execution
        int result = response.getStatusLine().getStatusCode();
        if (result == 200) {
            CharSequence toastText = "Success";
            Toast.makeText(context, toastText, toastDuration).show();
        } else {
            CharSequence toastText = "Failure";
            Log.d("checkin", String.valueOf(response.getStatusLine()
                    .getStatusCode()));
            Toast.makeText(context, toastText, toastDuration).show();
        }
    } catch (ClientProtocolException e) {
        CharSequence toastText = "ClientProtocolException";
        Toast.makeText(context, toastText, toastDuration).show();
    } catch (IOException e) {
        CharSequence toastText = "IOException";
        Toast.makeText(context, toastText, toastDuration).show();
    }

So what I need is a way to pull the completed URL from the httppost. the current string URL being passed is simply a base url such as : http://xx.com/ and the nameValuePairs follow it.
Thoughts?

  • 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-10T01:29:42+00:00Added an answer on June 10, 2026 at 1:29 am

    For HttpPost, the values are passed as the body of the request, so the URL is going to be the same as the one you pass in. You can, however, use EntityUtils.toString(HttpEntity entity) with your UrlEncodedFormEntity to print out the values that will be passed in the HttpPost.

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

Sidebar

Related Questions

I have a long URL on a web page in Windows that I need
Currently I have Long Pres Gesture Recognizers on four different TableViews (two in each
Currently, I have URLs that look like this: http://www.example.com/user/create http://www.example.com/user/edit/1 But now, I have
Examples of the strange URL(s) that we get when this occurs: (note the long
My situation is that I have a POST cgi script that generates and returns
I have a function that takes a url to an Excel file, and then
I have a webapp that needs to sometimes download some bytes from a url
This is my first post after being a long-time lurker - so please be
I am trying to build a URL that will bring up Google Maps in
I have a custom implementation of an Array Adapter that I'm using in a

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.