View

Tuesday 12 April 2011

Android Sample Running Program

Hi Friends,

Now we will see how to run hello world application and other sample applications.

HelloWorld App or HelloAndroid App


you need to comment out or delete this line in the program.
setContentView(R.layout.main);


For importing header, we have to click Ctrl+Shift+O
it didn't work for me, heres what i did

After pasting this line "import android.widget.TextView;
To import the header, you will see something to the right of the code window called "Outline"
Right click on the "import declarations"
in it choose "Source ->  Organise Imports"

Errors You might face :
You could face "Build Path Problem" error saying
Project 'com_example_android_blah....' is missing required source folder: 'gen'
when trying to run the the application.

If you encounter this error,
then go to "Project - > Clean " and run the project again.

Wait for the simulator to load, it will take upto 5 minutes,
If you are not seeing the application after 5 minutes, click on the "Menu" button on the right.


Running Sample Apps :

Open Eclipse IDE, Choose " File-> New -> Other "
Choose "Android -> Android Project "
Click Next
In the next screen,
Under "Build Target" , choose one sdk version from the available one.
Then, Click on the radio option "Create Project from existing sample"
Choose one of the samples from the drop down menu and Click on "Finish"

It will be added to the Package Explorer on the left,
Click on that name, then Just Run the application,
When a "Run as" dialog appera, Choose "Android Application" Click "OK",
You will see the simulator opening in some seconds, but wait for the simulator to finish  loading, it may take upto 5 minutes.

Hope you guys are able to replicate this.
If you are facing any issues, feel free to post to the mailing list, we will try to solve the issue.

No comments:

Post a Comment