• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps My first program but I need bit of help

Hello,

Following is my code
Code:
package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android");
        setContentView(tv);
    }
}
As per the output presented on developer.android.com, I should be getting Hello, Android printed on the emulator. But what I get is shown in the image I've attached. What maybe the possible reason and what shall I do to overcome the problem?

Thanks.
moz-screenshot.png
moz-screenshot-1.png
 

Attachments

  • Screenshot.png
    Screenshot.png
    34.4 KB · Views: 78
It looks like your emulator hasn't booted up fully. Try shutting it down, restarting it and then restarting your program again. BTW, you should see a normal home screen after your emulator completes booting up.
 
Thanks Boogs for the reply.

I restarted Eclipse but still there's no change in the output I get. On developer.android.com I saw a very different output screen. This one seems quite different. I installed Android 2.2 packages only because of Internet speed issues. Does that make any difference? I mean do I need to install packages for older version of Android as well?

Thanks.
 
Technically, you don't have to install the packages for the earlier versions of Android, but it's a good idea. I would install at least something as old as version 1.6. If you're targeting only android 2.2 users, then you're limiting yourself to a very small percentage of people. But, to get back to your current problem-your emulator still isn't starting correctly. When it does you will see the Android home screen with the "slide to unlock" that you would normally see on an Android phone.
 
I waited for some time after I got the screen that I posted in my 1st post. And then I got the emulator working properly. And also the Hello Android program worked fine. Thanks for your inputs. :)
 
Back
Top Bottom