Android code , Android Phone, Android Developers

Android code , Android Phone, Android Developers and New Google Android Technologies

Archive for March, 2011

Hello World! Again

Posted by admin March - 21 - 2011 - Monday ADD COMMENTS

While I have discussed the existence of this TextView in the xml, I have not yet discussed why it works without any corresponding code. I mentioned earlier in this book hat there are two ways to design a UI for Android: through the code, and through the main.xml file. The preceding code sample creates a TextView in xml and sets the text to “Hello World, HelloWorldText.” Edit this line of the main.xml file to read as follows:
android:text=”This is the text of an Android TextView!”
Rerun the project, and your results should appear as they do in this illustration. Take some time and experiment with the xml TextView.
Then you can move on to another way of creating a Hello World! application.

Hello World! Again
In this section, you will create another Hello World! application for Android. However, this time you will program the UI in code rather than by using the xml file—and you will actually do most of the work. The first step here is to remove the TextView code that is in main.xml. The following section of code represents the TextView. Removing it essentially makes your application an empty shell.
<TextView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”Hello World, HelloWorldText”
/>

After you have removed the TextView code, your main.xml file should look like this:
<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
>
</LinearLayout>
Now that you have a clean main.xml file, and thus a clean application shell, you can
begin to add the code that will display “Hello World!” on the screen. Start by opening the
HelloWorldText.java file and removing the following line:
setContentView(R.layout.main);

NOTE
You still need to set a ContentView for your new application; however, you are going
to implement it slightly differently from how it is implemented here, so it is best to just
remove the entire statement for now.

iPhone developer Company provides mobile application development services that offers complete mobile computing solution for all needs.

Cheapest cell phone plans Consumer Cellular is a nationwide provider of best cell phone plans and cell phones for senior citizens, young and adults which are cheap, affordable and without any contracts.