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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:27:09+00:00 2026-05-24T07:27:09+00:00

I am trying to send a JSON with the information email address, first and

  • 0

I am trying to send a JSON with the information email address, first and last names and expecting a response from the server to say {status: “Created”} or {status: “Resend”} and depending on the answer there would be a pop up message. I was wondering what I use to extract the information from the status class. Thanks!
Here is my code to accept

protected void sendJson(final String email, final String firstN,
        final String lastN) {
    Thread t = new Thread() {
        public void run() {
            Looper.prepare(); // For Preparing Message Pool for the child
                                // Thread
            HttpClient client = new DefaultHttpClient();
            HttpConnectionParams.setConnectionTimeout(client.getParams(),
                    10000); // Timeout Limit
            HttpResponse response;
            JSONObject json = new JSONObject();
            try {

                // post in the url


                HttpPost post = new HttpPost(
                        "https://iphone-radar.com/accounts");
                json.put("email_address", email);
                json.put("first_name", firstN);
                json.put("last_name", lastN);
                StringEntity se = new StringEntity("JSON: "
                        + json.toString());
                se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
                        "application/json"));
                post.setEntity(se);
                response = client.execute(post);
                /* Checking response */
                if (response != null) {
                    String str = response.getEntity().toString();
                    if (str.equals("Created")) {
                        new AlertDialog.Builder(CreateAccount.this)
                                .setTitle("Account Creation Successful")
                                .setMessage(
                                        "An activation code has been sent to you. Please check your SPAM folder if you do not receive your activation code email")
                                .setNeutralButton("OK", null).show();
                    } else if(str.equals("Resend")) {
                        new AlertDialog.Builder(CreateAccount.this)
                                .setTitle("Code Resent")
                                .setMessage(
                                        "Your activation code has been resent to your email.\n\nIf you are not receiving your activation code, our email is being blocked. Please email us at 'help@iphone-tracker.net' and we will manually send you a code.")
                                .setNeutralButton("OK", null).show();
                    }


                }
            } catch (Exception e) {
                e.printStackTrace();
            }

        }
  • 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-24T07:27:10+00:00Added an answer on May 24, 2026 at 7:27 am

    You should convert the response to a string, then create a JSONObject. You can then just access the JSON object’s properties. Try this:

    org.json.JSONObject obj = new org.json.JSONObject(org.apache.http.util.EntityUtils.toString(response.getEntity()));
                        if ("Created".equals(obj.getString("status"))) {
                            new AlertDialog.Builder(CreateAccount.this)
                                    .setTitle("Account Creation Successful")
                                    .setMessage(
                                            "An activation code has been sent to you. Please check your SPAM folder if you do not receive your activation code email")
                                    .setNeutralButton("OK", null).show();
                        } else if("Resend".equals(obj.getString("status"))) {
                            new AlertDialog.Builder(CreateAccount.this)
                                    .setTitle("Code Resent")
                                    .setMessage(
                                            "Your activation code has been resent to your email.\n\nIf you are not receiving your activation code, our email is being blocked. Please email us at 'help@iphone-tracker.net' and we will manually send you a code.")
                                    .setNeutralButton("OK", null).show();
                        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use JSON, I'm getting the information from the server so I've
I'm trying to use json to send text and blob image information from MySQL
I am trying to send an email from a site I am building, but
I am trying to get JSON data loaded from a NSURLConnection delegate to send
I am trying to send a JSON string to the server and retrieve back
I'm trying to send JSON data to a server. RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
I am trying to send JSON data from a form using the XMLHttpRequest object.
I'm trying to send json string in the get request to the server, here
i am trying to send a json string from my android client to my
I'm trying to send JSON information to jqgrid via Perl, however I'm struggling on

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.