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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:06:37+00:00 2026-05-18T00:06:37+00:00

I was given an assignment to develop a very simple weather app in Android

  • 0

I was given an assignment to develop a very simple weather app in Android using the data given from

http://forecast.weather.gov/zipcity.php

This would be my first actual android app, my only other experience is watching/reading many tutorials on getting started.

To give some background information of the app, it simply needs to have one activity that is a
text field for the user to enter a city, state combination, or just a zip code. This then needs to be submitted to the website’s (listed above) form.

After this has been submitted, my app needs to retrieve page sent in response and display it in a simple layout (possibly a listView of the days of the week).

My first question is, how would I go about submitting a text input to the above website’s form? Would I have to know the name of the form’s field to submit to it precisely?

In general, how should I start this process?


Edited version:

Using this code:

HttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost("http://forecast.weather.gov/zipcity.php?inputstring=04419");

    HttpResponse httpResp;

    try {
        httpResp = httpClient.execute(post);
        StatusLine status = httpResp.getStatusLine();
        Toast.makeText(getApplicationContext(), status.getStatusCode(), Toast.LENGTH_SHORT).show();


    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

I’m getting a:

10-26 15:29:56.686: DEBUG/SntpClient(59): request time failed: java.net.SocketException: Address family not supported by protocol

error in the debug view. Is this error related? Is my use of toast reasonable for testing if this http interaction is successful?

  • 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-18T00:06:37+00:00Added an answer on May 18, 2026 at 12:06 am

    When you want to see what a post request in passing use Firefox + tamperdata, that way you can look at how to use the webservice.

    I took a look at it, I searched for “33129” and when you enter text on the left hand box to start a search it simply pases 2 parameters:

    inputstring = "33129"
    Go2 = "Go"
    

    That would be one way to do it, on the other hand, once the request is finished it transforms it into another request, thats more specific. You can search by city state or zip, not both.

    If you request with a zip you get redirected to:

    http://forecast.weather.gov/MapClick.php?CityName=Miami&state=FL&site=MFL&lat=25.77&lon=-80.2
    

    So there is probably a redirection going on there.

    You are going to have to take a close look at how to work with this.

    Now, to do a post request in android use a name value pair like this.

    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                nameValuePairs.add(new BasicNameValuePair("inputstring","33129));
    

    Ramp’s answer shows the rest.

    Also, ALL comunication should be done on a thread that is not the main UI thread or you will get a ANR error.

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

Sidebar

Related Questions

No related questions found

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.