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

  • Home
  • SEARCH
  • 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 8956975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:53:07+00:00 2026-06-15T14:53:07+00:00

I am doing a weather project in android. The information is from a given

  • 0

I am doing a weather project in android. The information is from a given URL which is static and contains a list of cities. For example: HTTP://myexample/info/?cities displays a list of cities. HTTP://myexample/info/?tokyo will display: Tokyo, Japan.

I have done the layout to write down the name of the city to be executed:

xmlns:tools=["http://schemas.android.com/tools"]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Meteo" >
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingTop="40dp"
    android:weightSum="4">

    <LinearLayout 
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_weight="3">              

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/soleil" />
    </LinearLayout> 
            <LinearLayout 
            android:orientation="horizontal"
        android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="4">

            <EditText
                android:id="@+id/editText1"
                android:layout_width="170dp"
                android:layout_height="wrap_content"
                android:ems="10" >
            <requestFocus />
            </EditText>
            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/button" />

</LinearLayout>

But the Java program doesn’t execute. Only the layout is executed:

public class Demo {

public static void main(String[] args) {

    // URL
    String url = "$HTTP://myexample/info/?cities$";

    // Weather information

    String weather = "Tokyo, Japan#15.5#Sun ##";

    // Get the city name
    String city = url.substring(url.indexOf("?") + 1).trim();

    System.out.println(city);
    // Check the weather of the city: 15.5#Sun
    // Remove city name
    // Remove last #

    if (weather.toLowerCase().contains(city.toLowerCase())) {

        // Get condition: 

        String condition = weather.substring(weather.indexOf("#") + 1,
                weather.length() - 2);
        System.out.println(condition);
        // Split with # sign and you have a list of conditions

        String[] information = condition.split("#");
        for (int i = 0; i < information.length; i++) {

            System.out.println(information[i]);
        }
    }
}
}

Where is the problem?

  • 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-15T14:53:08+00:00Added an answer on June 15, 2026 at 2:53 pm

    Look up Activities. In Android you’ll have to create a class that extends Activity. The equivalent to the main() method is the OnCreate() method. In this method you can set your layout with setContentView(layout id)

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

Sidebar

Related Questions

When I try to retrieve information from Google weather API with the following URL,
Where can I find historical raw weather data for a project I am doing
I want to Integrate Weather radar on my MapView.Please anyone help on doing this
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing code analysis of the project and get the message Reference-counted object is used
I'm parsing a JSON response from a weather feed and the data I receive
I am doing a weather report app. So i am going to get the
What I want? I want to display weather information on my page. I want
Background: I have a simple web page displaying current weather conditions from a backyard
Doing some initial research on a new project and one of my requirements is

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.