KaranGupta
asked on
unable to execute hello world
Hi
I have just started andriod for that I have created the hello world sample.
But when I run the project I see only blank screen. Am I missing something
I am attaching the project. Please help me out.
P.S - Please rename the file to .rar
Regards
Karan workspace.txt
I have just started andriod for that I have created the hello world sample.
But when I run the project I see only blank screen. Am I missing something
I am attaching the project. Please help me out.
P.S - Please rename the file to .rar
Regards
Karan workspace.txt
ASKER
HI
Still I am not getting hello world
Still I am not getting hello world
package Hello.World.Package;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Hello_WorldActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
setContentView(tv);
tv.setText("Hello, Android");
}
}
Actually, you must tell android where to draw your widgets like a txtview one.
This should work, assuming you have a main.xml file in your (hello_world project root)/res/layout directory.
If you are using Eclipse, double-clicking on that file will allow you to place different widgets on your layout.
This should work, assuming you have a main.xml file in your (hello_world project root)/res/layout directory.
If you are using Eclipse, double-clicking on that file will allow you to place different widgets on your layout.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = new TextView(this);
setContentView(tv);
tv.setText("Hello, Android");
ASKER
HI OHUPE
Still the result is same. I am attaching the screen shot. Have you tried this code on your system. If it works well then probably there might be some issue in the installation of the sdk or may be some issue in settings.
Kindly advice
Regards
Karan Gupta
andriod-Hello-World.jpg
Still the result is same. I am attaching the screen shot. Have you tried this code on your system. If it works well then probably there might be some issue in the installation of the sdk or may be some issue in settings.
Kindly advice
Regards
Karan Gupta
andriod-Hello-World.jpg
I think it might be a configuration issue. Did you read the console content while lauching the helloworld app ?
Remember that the target you choosed is level 14, that means Android 4.0 OS. Did you update your SDKs using the "Window"->"Android SDK Manager" menu item ?
s-shot.jpg
Remember that the target you choosed is level 14, that means Android 4.0 OS. Did you update your SDKs using the "Window"->"Android SDK Manager" menu item ?
s-shot.jpg
ASKER
Hi OHUPE
Thanks for the reply
"Did you read the console content while lauching the helloworld app ?"
[Comments]: I am not getting it. Could you please elaborate this?
"Did you update your SDKs using the "Window"->"Android SDK Manager" menu item ?"
[Comments]: I am attaching the screenshot for "Window"->"Android SDK Manager". Please check if everything is properly installed.
Regards
Karan Gupta
andriod-Hello-World.jpg
Thanks for the reply
"Did you read the console content while lauching the helloworld app ?"
[Comments]: I am not getting it. Could you please elaborate this?
"Did you update your SDKs using the "Window"->"Android SDK Manager" menu item ?"
[Comments]: I am attaching the screenshot for "Window"->"Android SDK Manager". Please check if everything is properly installed.
Regards
Karan Gupta
andriod-Hello-World.jpg
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
tv.setText("Hello, Android");
AFTER the line containing :
setContentView(tv);