Java program does not execute in Android
<p>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: <code>HTTP://myexample/info/?cities</code> displays a list of cities. <code>HTTP://myexample/info/?tokyo</code>  will display: Tokyo, Japan.</p>

<p>I have done the layout to write down the name of the city to be executed:</p>

<p>

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

    &lt;LinearLayout 
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_weight="3"&gt;              

        &lt;ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/soleil" /&gt;
    &lt;/LinearLayout&gt; 
            &lt;LinearLayout 
            android:orientation="horizontal"
        android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="4"&gt;

            &lt;EditText
                android:id="@+id/editText1"
                android:layout_width="170dp"
                android:layout_height="wrap_content"
                android:ems="10" &gt;
            &lt;requestFocus /&gt;
            &lt;/EditText&gt;
            &lt;Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/button" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p></p>

<p></p>

<p>But the Java program doesn't execute. Only the layout is executed:</p>

<pre><code>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 &lt; information.length; i++) {

            System.out.println(information[i]);
        }
    }
}
}
</code></pre>

<p>Where is the problem?</p>
