problems getting started

by leeuwerik » Fri, 04 Sep 2009 01:52:58 GMT

Sponsored Links
 I'm brand new to Android (although not to Eclipse and Java).
Yesterday I installed ADT within Eclipse (always latest versions) both
on Windows and XP.
Then I try creating HelloWorld by following the tutorial.

When creatin the android project I get an error on the line
setContentView(R.layout.main) ==> R unknown.

I tried ctr-shift-O ==> import android.R is added but the error

Undaunted I follow the tuturial and edit to create a TextView instead
==> application runs, i.e. I see a mobile terminal image with
'ANDROID' written in the centre. On XP it's strange: after a seemingly
long time-out the text font changes and an icon (android) is added
after the text.

Next I try editing the resource .xml files as suggested in the
tutorial in order to change the text. This also implies reintroducing
the line with setContentView(R.layout.main) in lieu of the TextView.
This time no error reported !!!!

When inspecting main.xml, the new layout and text look OK. Yet when
running the application I keep getting the same mobile picture, i.e.
without the new text. It looks like the emulation doesn't work
I rebuilt the application from scratch and did another tutorial, with
the same negative result.

I must say that I'm lost.
Can anyone help please ????


problems getting started

by Justin Anderson » Fri, 04 Sep 2009 04:37:46 GMT

 R is a class that is generated at compile-time.

In particular, to get R.layout.main you need to create a file names main.xml
in your res/layout folder and create the layout in xml format as described
in the Dev Guide docs.

I've never used the emulator (I push my apps directly to my phone for
debugging) so I can't help with that...

Let me know if this helps,

There are only 10 types of people in the world...
Those who know binary and those who don't.


Sponsored Links

problems getting started

by Roman ( T-Mobile USA) » Fri, 04 Sep 2009 05:03:54 GMT

 When you create your first Android application you normally have not
to do anything besides creating an Android project. The Eclipse ADT is
going to create all the needed resources for you.

Check the following

 - Your Eclipse:
for example
Version: 3.4.1
Build id: M20080911-1700

 - the Problems-tab in Eclipse editor
 - make sure that ADT is correctly installed
Roman Baumgaertner
Sr. SW Engineer-OSDC
T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


problems getting started

by John P. » Fri, 04 Sep 2009 06:13:33 GMT

 Regarding the cases when the R class does not get generated/updated in
time, try the following (in no particular order):

- Manually delete the class, so the next time it will generate
a completely new one.
- Right click on the project -> Android Tools -> Fix Project
- Clean the project under Project -> Clean
- Restart Eclipse

Regarding the case when updating the text in the layout did not
reflect in the emulator, are you sure the latest project was deployed
to the emulator?  Can you confirm that the APK is built and pushed to
the emulator by looking at the console?  Sometimes, the ADB has issues
and it disconnects with the emulator.  If this was the case, your
emulator was still running the previous version.


problems getting started

by leeuwerik » Fri, 04 Sep 2009 17:46:48 GMT

 Thanks for your reply.
main.xml is properly created, so that is not the problem
See also my answer in the reply to John P.


problems getting started

by leeuwerik » Fri, 04 Sep 2009 17:47:22 GMT

 Thank you for your reply.
I did not delete class since I could not find it.
But I did the right click fix as you suggested + clean + rebuild all
(no restart Eclipse) ==> problem went away

Re. the emulator. I realized that it is EXTREMELY slow even on my new
double Pentium PC.
It takes nearly 2 minutes to launch and display the application in the
emulated terminal.
Not very useful for development !!!!!!
The better way to view the screen is by displaying main.xml.


problems getting started

by John P. » Fri, 04 Sep 2009 21:17:15 GMT

 ust FYI, you don't need to close and restart the emulator every time
you want to deploy something. It also takes me about 2 minutes to
boot up the emulator the first time, but about 5 seconds to deploy
afterwards. As usual, you can confirm it was deployed successfully by
checking the console.

On Sep 4, 5:43am, leeuwerik <> wrote:

problems getting started

by QTB QTB » Sat, 05 Sep 2009 02:25:09 GMT

 Try removing import android.R, then rebuild.


problems getting started

by Tiago Becker » Sat, 05 Sep 2009 02:30:08 GMT

 On my pc, it  took really  a looong time to move from the "android"
screen to the home screen on the emulator, the first time i tried (i
did kill the process 3 or 4 times before letting it run for like 10

My guess is that your program is ok, its just the emulator that is
slow as hell....

On Thu, Sep 3, 2009 at 6:03 PM, Roman ( T-Mobile


problems getting started

by tinyang » Sat, 05 Sep 2009 03:23:21 GMT

 he emulator can be very slow depending on the specs of the machine it's
running on. Not bad on my dev pc, it opens and runs my app in less than a

-----Original Message-----
[] On Behalf Of Tiago Becker
Sent: Thursday, September 03, 2009 4:09 PM
Subject: [android-beginners] Re: problems getting started

On my pc, it took really a looong time to move from the "android"
screen to the home screen on the emulator, the first time i tried (i did
kill the process 3 or 4 times before letting it run for like 10

My guess is that your program is ok, its just the emulator that is slow as

On Thu, Sep 3, 2009 at 6:03 PM, Roman ( T-Mobile
USA)<> wrote:

No virus found in this incoming message.
Checked by AVG -
Version: 8.0.169 / Virus Database: 270.13.71/2332 - Release Date: 9/3/2009
6:05 PM


Other Threads

1. Device coming back from sleep is effecting the UI

My buttons stop reacting to the mouse clicks after the device comes
back from sleep. The buttons receive the the click events since
actions associated with the buttons are executed but visually they do
not appear to be pressed when being clicked. I am using selector to
define the drawables for the button's states.

The same happens when switching from portrait to landscape, or vice
versa. My application is configured for a sensor. Any ideas?


2. How to Stop LocationManager correct and make the Satellite symbol disappear ?

package s.s;

import android.os.Bundle;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.view.KeyEvent;
import android.widget.TextView;
import android.widget.Toast;

public class Gps extends Activity implements LocationListener
    private TextView textView;
    private LocationManager locationManager;

        public boolean onKeyDown(int keyCode, KeyEvent event) {
                if (keyCode == KeyEvent.KEYCODE_S) {

                        .makeText(this, "#_removed", 500)

                        return (true);
                return (super.onKeyDown(keyCode, event));

    public void onCreate(Bundle savedInstanceState)

        Criteria criteria = new Criteria();
        this.textView = (TextView)findViewById(;
        this.locationManager = (LocationManager) getSystemService
                this.locationManager.getBestProvider(criteria, true),

    public void onLocationChanged(Location location)
        this.textView.setText("Latitude : " + Double.toString
(location.getLatitude()) + "  Longitude : " + Double.toString

    public void onProviderDisabled(String arg0) {


    public void onProviderEnabled(String arg0) {


    public void onStatusChanged(String provider, int status, Bundle b)


The Satellite symbol don't disappear. (never - until i press the
standby button)

Why isn't that


working when i press s on the keyboard (why don't the Satellite symbol

But when i start Google Maps and stop it the Satellite symbol

So what i have to more??



3. Controlling the current MediaPlayer

4. Resolusi video

5. Regarding SharedPreferences and my use-case.

6. Viamici 鈥?the First Map Calibrat ion Solution for the Android Platform

7. S/MIME and Digital Certificate Support on Androi