Problem at android apps loading


Last Updated:

  1. afrodom

    afrodom New Member This Topic's Starter

    Joined:
    Aug 22, 2010
    Messages:
    1
    Likes Received:
    0
    Hi, I have just start to develop android, and I just cannot start my Hello World application.
    <br /> I have followed instructions about android installation, I have changed several IDE's, but still, when I press f11 to compile, it 'does' some job int he background, activate my virtual device, but wont to behave just as it should!
    <br /> Only " Android . . . " is displayed on the screen, which mean that my class isn't 'loaded', somehow.
    <br /> This is sample class :
    <br />
    <br /> <textarea name="code" class="java" cols="60" rows="10">
    package test.and;
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;


    public class TestAppActiv extends Activity {
    Button button1;
    EditText txtbox1,txtbox2;
    TextView tv;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    txtbox1= (EditText) findViewById(R.id.txtbox1);
    button1 = (Button) findViewById(R.id.button1);
    tv = (TextView) findViewById(R.id.lbl1);
    txtbox2= (EditText) findViewById(R.id.txtbox2);
    button1.setOnClickListener(new Clicker());
    }
    class Clicker implements Button.OnClickListener
    {
    public void onClick(View v)
    {
    String a,b;
    Integer vis;
    a = txtbox1.getText().toString();
    b = txtbox2.getText().toString();
    vis = Integer.parseInt(a)+Integer.parseInt(b);
    tv.setText(vis.toString());
    }
    }
    }
    </textarea>
    <br /> And, also main.xml file, which reflect contains xml representation of display window :
    <br /> main.xml :
    <br /> <textarea name="code" class="java" cols="60" rows="10">
    &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;AbsoluteLayout
    android:id="@+id/widget35"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    &gt;
    &lt;EditText
    android:id="@+id/txtbox1"
    android:layout_width="145px"
    android:layout_height="40px"
    android:text="EditText"
    android:textSize="18sp"
    android:layout_x="75px"
    android:layout_y="54px"
    &gt;
    &lt;/EditText&gt;
    &lt;EditText
    android:id="@+id/txtbox2"
    android:layout_width="144px"
    android:layout_height="40px"
    android:text="EditText"
    android:textSize="18sp"
    android:layout_x="75px"
    android:layout_y="109px"
    &gt;
    &lt;/EditText&gt;
    &lt;Button
    android:id="@+id/button1"
    android:layout_width="106px"
    android:layout_height="36px"
    android:text="Button"
    android:layout_x="88px"
    android:layout_y="224px"
    &gt;
    &lt;/Button&gt;
    &lt;TextView
    android:id="@+id/lbl1"
    android:layout_width="141px"
    android:layout_height="wrap_content"
    android:text="TextView"
    android:layout_x="76px"
    android:layout_y="166px"
    &gt;
    &lt;/TextView&gt;
    &lt;/AbsoluteLayout&gt;
    </textarea>
    <br />
    <br /> then, strings.xml :
    <br /> <textarea name="code" class="java" cols="60" rows="10">
    &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;resources&gt;
    &lt;string name="hello"&gt;Hello World, TestAppActiv!&lt;/string&gt;
    &lt;string name="app_name"&gt;TestApp&lt;/string&gt;
    &lt;/resources&gt;

    </textarea>
    <br />
    <br /> AndroidManifest.xml :
    <br />
    <br /> <textarea name="code" class="java" cols="60" rows="10">
    &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="test.and"
    android:versionCode="1"
    android:versionName="1.0"&gt;
    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
    &lt;activity android:name=".TestAppActiv"
    android:label="@string/app_name"&gt;
    &lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.MAIN" /&gt;
    &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
    &lt;/intent-filter&gt;
    &lt;/activity&gt;

    &lt;/application&gt;


    &lt;/manifest&gt;
    </textarea>
    <br />
    <br /> and default.properties file :
    <br /> <textarea name="code" class="java" cols="60" rows="10">

    # This file is automatically generated by Android Tools.
    # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
    #
    # This file must be checked in Version Control Systems.
    #
    # To customize properties used by the Ant build system use,
    # "build.properties", and override values to adapt the script to your
    # project structure.

    # Project target.
    target=android-3
    </textarea>
    <br />
    <br /> Just as I said, I did install everything I needed (SDK, ADT plugin, etc...), but it still wont work
    <br /> I appreciate any help!
    <br /> Thanks
     

    Advertisement
  2. jonbonazza

    jonbonazza Well-Known Member

    Joined:
    Jul 13, 2010
    Messages:
    1,934
    Likes Received:
    458
    You are not doing anything wrong. The first time you launch an AVD (Android Virtual Device; a.k.a emulator) in a session for any IDE, it will take a while to load. Just start the AVD (emulator) and let it sit for a while. It will eventually start. After the first time staring it in a session, the following starts in that session will take significantly less time to boot up. With this said, after you start it once, you could just leave it running as every time you recompile the source code, it uninstalls and reinstalls the app on the AVD (emulator), so there is no need to continuously start and stop the AVD (emulator).
     

Share This Page

Loading...